The tournament sort is a sorting algorithm that works by building an ordered binary tree. We represent the elements to be sorted by vertices that sill become the leaves. We build up the tree one level at a time we would construct the tree representing the winners of matches in a tournament Working left to right, we compare pairs of consecutive elements, adding a parent vertex labeled with the larger of the two elements under comparison. We make similar comparisons between labels of vertices at each level until we reach the root of the tree that is labeled with the largest element. The tree constructed by the tournament sort of , 8.14,17,3,9,27,11 is ilinstrated in part(a)ef the figure. Once the argestelementhbeendetermined. The leaf with this labelisrelabeled by -s,which is definedtobelessthanevery element The labels of all vertices on the path from this vertex up to the root of the tree are recalculated, as shown in part (b) of the figure.
This produces the second largest element This process continues until the entire list has been sorted.
22. Given the coding scheme a: 001, b: ooo1. e: i, r: 0000, s: 0100, t: oil, x 01010, find the word represented by
a) 01110100011.
b) 0001110000.
c) 0100101010.
d) 01100101010.
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
Discrete Mathematics and Its Applications ( 8th International Edition ) ISBN:9781260091991
- A double star is a tree that has exactly two nodes that are not leaves. How many unlabeled double stars are there on n nodes?arrow_forwardSuppose we are given the letters to the word ALGORITHM for which we’d like to study the number of permutations and combinations of various subsets of this set of letters. (1a) How many ways can three of the letters of the word ALGORITHM be selected and written in a row? (1b) How many ways can three of the letters of the word ALGORITHM be selected and written in a row but where we do wish to account for the order of 3 letters? That is, the selection ALG is considerd the same as GLA and the also the same as LGA, and thus, these 3 orderings should only be counted once. (1c) How many ways can six letters of the word ALGORITHM be selected and written in a row if the first letter must be an A? (1d) How many ways can six letters of the word ALGORITHM be selected and written in a row if the first letter must be an A?, but where order is not important?arrow_forwardwhat is the neignboring algorithmarrow_forward
- College Algebra (MindTap Course List)AlgebraISBN:9781305652231Author:R. David Gustafson, Jeff HughesPublisher:Cengage Learning