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.
14. Use the tournament sort to sort the list 17, 4, 1, 5, 13, 10, 14, 6.

Want to see the full answer?
Check out a sample textbook solution
Chapter 11 Solutions
DISCRETE MATH CONNECT ACCESS
- Answer question 3 pleasearrow_forward38 Below triangle is isosceles. Find the value of x. 70° 60° x 20° Warrow_forwardProblem 11 (a) A tank is discharging water through an orifice at a depth of T meter below the surface of the water whose area is A m². The following are the values of a for the corresponding values of A: A 1.257 1.390 x 1.50 1.65 1.520 1.650 1.809 1.962 2.123 2.295 2.462|2.650 1.80 1.95 2.10 2.25 2.40 2.55 2.70 2.85 Using the formula -3.0 (0.018)T = dx. calculate T, the time in seconds for the level of the water to drop from 3.0 m to 1.5 m above the orifice. (b) The velocity of a train which starts from rest is given by the fol- lowing table, the time being reckoned in minutes from the start and the speed in km/hour: | † (minutes) |2|4 6 8 10 12 14 16 18 20 v (km/hr) 16 28.8 40 46.4 51.2 32.0 17.6 8 3.2 0 Estimate approximately the total distance ran in 20 minutes.arrow_forward
- - Let n = 7, let p = 23 and let S be the set of least positive residues mod p of the first (p − 1)/2 multiple of n, i.e. n mod p, 2n mod p, ..., p-1 2 -n mod p. Let T be the subset of S consisting of those residues which exceed p/2. Find the set T, and hence compute the Legendre symbol (7|23). 23 32 how come? The first 11 multiples of 7 reduced mod 23 are 7, 14, 21, 5, 12, 19, 3, 10, 17, 1, 8. The set T is the subset of these residues exceeding So T = {12, 14, 17, 19, 21}. By Gauss' lemma (Apostol Theorem 9.6), (7|23) = (−1)|T| = (−1)5 = −1.arrow_forwardLet n = 7, let p = 23 and let S be the set of least positive residues mod p of the first (p-1)/2 multiple of n, i.e. n mod p, 2n mod p, ..., 2 p-1 -n mod p. Let T be the subset of S consisting of those residues which exceed p/2. Find the set T, and hence compute the Legendre symbol (7|23). The first 11 multiples of 7 reduced mod 23 are 7, 14, 21, 5, 12, 19, 3, 10, 17, 1, 8. 23 The set T is the subset of these residues exceeding 2° So T = {12, 14, 17, 19, 21}. By Gauss' lemma (Apostol Theorem 9.6), (7|23) = (−1)|T| = (−1)5 = −1. how come?arrow_forwardShading a Venn diagram with 3 sets: Unions, intersections, and... The Venn diagram shows sets A, B, C, and the universal set U. Shade (CUA)' n B on the Venn diagram. U Explanation Check A- B Q Search 田arrow_forward
- 3. A different 7-Eleven has a bank of slurpee fountain heads. Their available flavors are as follows: Mountain Dew, Mountain Dew Code Red, Grape, Pepsi and Mountain Dew Livewire. You fill five different cups full with each type of flavor. How many different ways can you arrange the cups in a line if exactly two Mountain Dew flavors are next to each other? 3.2.1arrow_forwardBusinessarrow_forwardWhat is the area of this figure? 5 mm 4 mm 3 mm square millimeters 11 mm Submit 8 mm Work it out 9 mmarrow_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





