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.
26.
a) Use Huan coding to encode these symbols with frequencies a: 04, b: 0.2, C: 0.2, d 0.1, e: 0.1 in two different ways by breaking ties inthe aorithmdifferenUy, First. among the trees of minimum weight select two trees with the largest ntunberof vertices to
combineateachstageoftheaorithni Second, amongthe trees of mmimmweightselectreeswiththesmaflestnumberof
vertices at each stage.
b) Compute the average number of bits required to encode a symbol with each code and compute the variances of this number of bits for each code. Which tie-breaking procedure produced the smaller variance in the number of bits required to encode a symbol?
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
DISCRETE MATHEMATICS+ITS APPL. (LL)-W/A
- Can you help me find the least number of vertices that make up the secure total dominating set of this graph?arrow_forwardUse the critical path algorithm to create a priority list for the digraph below. T4 (5) Т6 (11) T1 (8) End T2 (10) T5 (6) T7 (7) ТЗ (12) 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_forwardUse 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_forward
- Diagram the recursive tree in a number of paths method: numPath(row: 3, col: 3) starting location: 0,0 please draw the recursive tree that goes up to 3, 3 in the numPath call method.arrow_forwardCoordinates for a clipping window and a line are given in the following figure. Use Liang- Q1. Barsky algorithm to clip this line with respect to the clipping window. Show your steps and calculations clearly. Ymax=20- Po(8, 12) Ymin=10 P1(30,6) Xmin=10 Xmax=20arrow_forwardHow many total ways are there to select a group of five letters from the word ALGORITHM and arrange them in a straight line? How many distinguishable arrangements are there of the letters in the word BASSOONISTS?arrow_forward
- Chess is a board game, where the board is made up of 64 squares arranged in an 8-by-8 grid. One of the pieces is a rook, which can move from its current square any number of spaces either vertically or horizontally (but not diagonally) in a single turn. Discuss how you could use graphs to show that a rook can get from its current square to any other square on the board in at most two turns. You’re encouraged to utilize relevant graph definitions, problems, and algorithms where appropriate.arrow_forwardExplain the step by step procedure of Dijktra’s algorithm to find the shortest path between any two vertices?arrow_forwardWhat is the nearest neighbor algorithmarrow_forward
- Please help me with these questions. I am having trouble understanding what to do. Please show all your work Thank youarrow_forwardDO LETTERS A & B FOR UPVOTE. PLEASE SKIP THIS IF YOU ALREADY DID THIS. THANK YOU SO MUCH. I REALLY NEED DIFFERENT ANSWERS.arrow_forwardFind the shortest path from vertex 'S' to 'T’ by Dijkstra's algorithm for the weighted graph: 3 3 d 1 4arrow_forward
- Discrete Mathematics and Its Applications ( 8th I...MathISBN:9781259676512Author:Kenneth H RosenPublisher:McGraw-Hill EducationMathematics for Elementary Teachers with Activiti...MathISBN:9780134392790Author:Beckmann, SybillaPublisher:PEARSON
- Thinking Mathematically (7th Edition)MathISBN:9780134683713Author:Robert F. BlitzerPublisher:PEARSONDiscrete Mathematics With ApplicationsMathISBN:9781337694193Author:EPP, Susanna S.Publisher:Cengage Learning,Pathways To Math Literacy (looseleaf)MathISBN:9781259985607Author:David Sobecki Professor, Brian A. MercerPublisher:McGraw-Hill Education