A bubble (swap) sorter is used to sort 100,000 words for an English language dictionary application....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A bubble (swap) sorter is used to sort 100,000 words for an English language dictionary application. a) Show that the number of swaps required to sort N words in a dictionary is approximately N². [1 mark] b) A student measures that a swap operation takes 0.01 ms on an old piece of hardware. Ignoring all other computing overheads, exactly how long will it take to sort the dictionary into alphabetical order? [1 mark] c) How many comparison operations would it take on average to locate a word in a sorted dictionary using linear search? [1 mark] d) Explain whether the answer for part (c) would be different if the dictionary was unsorted? [1 mark] e) How many comparison operations would it take to locate a word in the sorted dictionary using a binary search? [3 mark] f) Explain, with the aid of diagrams as appropriate, how a sorted list of words could be organised into a binary search tree. A bubble (swap) sorter is used to sort 100,000 words for an English language dictionary application. a) Show that the number of swaps required to sort N words in a dictionary is approximately N². [1 mark] b) A student measures that a swap operation takes 0.01 ms on an old piece of hardware. Ignoring all other computing overheads, exactly how long will it take to sort the dictionary into alphabetical order? [1 mark] c) How many comparison operations would it take on average to locate a word in a sorted dictionary using linear search? [1 mark] d) Explain whether the answer for part (c) would be different if the dictionary was unsorted? [1 mark] e) How many comparison operations would it take to locate a word in the sorted dictionary using a binary search? [3 mark] f) Explain, with the aid of diagrams as appropriate, how a sorted list of words could be organised into a binary search tree.
Expert Answer:
Answer rating: 100% (QA)
a In a bubble sortthe number of swaps required in each pass is approximately equal to the number of elements out of orderIn the first passthe largest element is moved to the end of the listleaving N1 ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
When a court will make a decision about "duty" rather than one about "breach"?
-
In April 1992, EuroDisney SCA opened its doors to European visitors. Located by the river Marne some 20 miles east of Paris, it was designed to be the biggest and most lavish theme park that Walt...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
a. Determine IC and VCE for the network of Fig. 4.115. In Figure 4.115 b. Change β to 120 (50% increase), and determine the new values of lC and VCE for the network of Fig. 4.115. c....
-
1. Which one of the following is not expected to occur on an H-R diagram during the lifetime of a single star? (a) The star will move off the main sequence toward the upper right of the diagram. (b)...
-
Prove Theorem 5.5.13; that is, show that a. Set e = |x - | and show that if x > , then P(Xn x) > P(|Xn - | ). Deduce the => implication. b. Use the fact that {x : |x - >} = {x : x - . } to deduce...
-
Lakewood Co. issues \(\$ 100,000\) of \(6 \%, 20\)-year bonds payable that are dated April 30. Record (a) issuance of bonds at par on Nay 31 (b) the next semiannual interest payment on October 31.
-
Amalgamated Products has three operating divisions: To estimate the cost of capital for each division, Amalgamated has identified the following three principal competitors: Assume these betas are...
-
Explain the difference between transportation problem and assignment problem ( 5 marks) Country manager Dr. David Chemirmir has a problem of assigning his medical representatives to sales...
-
Trace or copy the graph of the given function f. (Assume that the axes have equal scales.) Then use the method of Example 1 to sketch the graph of f' below it. yA
-
Factory Overhead Controllable Variance Lo-bed Company produced 4,000 units of product that required four standard hours per unit. The standard variable overhead cost per unit is $3.00 per hour. The...
-
Incident light of wavelength 1064 nm is Raman scattered in a glass with localized vibrational frequency fv = 20 THz. Determine the wavelength of the scattered light
-
Student, Inc. had $330,000 in 2023 taxable income. Using the graduated rate table\ below,\ a. Calculate Student, Inc.s income tax liability.\ b. What is Student, Inc.s average tax rate?\ c. What is...
-
1. Calculate the density of a rock that weights 4.56grams and has a volume of 2.88 cm 3. 2. A nail weighing 7.88 grams is placed in a graduated cylinder containing 22.35 mL of distilled water. When...
-
Charlize Theron and her daughter are on a seesaw in the park. How far from the center must 111 lb Char- lize sit in order to balance the 48 lb daughter sitting 5 ft from the center? Answer in units...
-
As a strategist you are required to undertake a task and submit a consultancy paper to the Board of Directors of a Multinational Company that seeks to learn strategy lessons from the Ghanaian...
-
Ramona and Hermione formed Wiley Corporation on January 2. Ramona contributed cash of $295,000 in return for 50 percent of the corporation's stock. Hermione contributed a building and land with the...
-
Find the inverse, if it exists, for the matrix. -1
-
Determine whether the definition gives an inner product. i 8) = (max f(x))(,max g(x)) for f, g in C[0, 1] 0
-
Find the general solution to the given system of differential equations. Then find the specific solution that satisfies the initial conditions. (Consider all functions to be functions of t.) x 1 = x...
-
Find the orthogonal complement W ¥ of W and give a basis for W ¥ . 5z = 0 : - + 5z 3D 0
-
Consider the monthly simple excess returns of 10 U.S. stocks from January 1990 to December 2003 for 168 observations. The 3-month Treasury bill rate on the secondary market is used to compute the...
-
Which provides stronger evidence against H0: a P-value of 0.05 or a P-value of 0.50?
-
A test is made of H0 : = 6 versus H1: 6. a. The test statistic is z = 0.75. Find and interpret the P-value. b. The test statistic is z = 2.20. Find and interpret the P-value. c. Which provides...
Study smarter with the SolutionInn App