11.2 Application of Trees Flashcards
A binary search tree is a binary tree with the following properties:
- Each vertex has a value called a key.
- The left subtree of a vertex contains only vertices with keys less than the vertex’s key.
- The right subtree of a vertex contains only vertices with keys greater than the vertex’s key.
- The left and right subtree must also be a binary search tree.
A binary search tree is a binary tree with the following properties:
- Each vertex has a value called a key.
- The left subtree of a vertex contains only vertices with keys less than the vertex’s key.
- The right subtree of a vertex contains only vertices with keys greater than the vertex’s key.
- The left and right subtree must also be a binary search tree.
Decision Trees
A rooted tree in which each internal vertex corresponds to a decision, with a subtree at these
vertices for each possible outcome of the decision
Decision Trees
A rooted tree in which each internal vertex corresponds to a decision, with a subtree at these
vertices for each possible outcome of the decision
Dec. Tree Theorem 1
A sorting algorithm based on binary comparisons requires at least [log n!] comparisons.
Dec. Tree Corollary 1
The number of comparisons used by a sorting algorithm to sort n elements based on binary comparisons
is Ω(n log n).
Dec. Tree Theorem 2
The average number of comparisons used by a sorting algorithm to sort n elements based on binary
comparisons is Ω(n log n).
Dec. Tree Theorem 2
The average number of comparisons used by a sorting algorithm to sort n elements based on binary
comparisons is Ω(n log n).
Prefix Codes
encode letters so that the bit string for a letter never occurs as the first part of the bit
string for another letter.
Prefix Codes
encode letters so that the bit string for a letter never occurs as the first part of the bit
string for another letter.
Huffman Coding
An algorithm that takes as input the frequencies of symbols in a string and produces an output a
prefix code that encodes the string using the fewest possible bits, among all possible binary prefix
codes for these symbols.