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.
24. UseHuffmancodingtoencodethesesvmbo1siithgivenfrequencies:A:0.10.B:0.25,C:0.05.D: 0.15,E:0.30,F:0.07,G: 0.08. What is the average number of bits required to encode a symbol?
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
Discrete Mathematics and Its Applications ( 8th International Edition ) ISBN:9781260091991
- can you please make a tree diagram of this situationarrow_forwardWhat is the two possible routes, the greedy and edge-picking algorithm, what are the difference of these routes. Can you also help me understand what are the difference of the processarrow_forwardIvan plays four field tennis matches. Build a tree diagram to indicate the possible mbinations of matches won and lost matches Ivan can have in all four matches.arrow_forward
- Use the critical path algorithm to create a priority list for the digraph below. T1 (2) T4 (12) Т6 (5) End T2 (7) T5 (4) T7 (11) Т3 (9) Priority list: Give the priority as a list of task numbers. For example, you'd enter something like: 1,2,3,4,5,6,7,8,9,10arrow_forwardFor a full 5-ary tree: (a) find the total number of vertices and (b) leaves when there are 7 internal vertices.arrow_forwardThis is also about graph theory but with the nearest algorithmarrow_forward
- Linear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage Learning