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.
19. Which of these codes are prefix codes?
a) a: 11, e: 00, t: 10, s: 01
b) a: o,e: l,t: ol,s: 001
c) a: 101, e: 11, t: 001, s: Oil, n: 010
d) a: 010, e: 11, t: O11,s: 1011, n: 1001, j: 10101
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
DISCRETE MATHEMATICS LOOSELEAF
- Complete the tree diagram by filling in the missing entries below.arrow_forwardCreate a tree diagram to show the possible answer combinations of the first three questions on the take-home assignment.arrow_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
- Coordinates 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_forwardChess 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_forward
- Please help me with these questions. I am having trouble understanding what to do. Please show all your work Thank youarrow_forwardWhich of the following is not true about Kruskal's algorithm? Arrange the edges based on their weights Avoid loops Identify the edges and their weight The created edges is equal to the number of verticesarrow_forwardA college offers three types of programs: bachelors, Masters, and Doctorate. In the recent past, 70% of the students started the Bachelors program, 25% started the Masters program, and 5% started the PhD program. Of students starting the Bachelors program, 15% did not finish their degree; of students starting the Masters program, 34% did not finish their degree; and of students starting the PhD program, 42% did not finish their degree. Draw a tree diagram including the probabilities for each branch. If a student is selected at random, find the probability that they did not finish the program.arrow_forward
- 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_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