2 Dictionary Abstract Datatype (16 points) Recall that the dictionary abstract data type stores a collection...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2 Dictionary Abstract Datatype (16 points) Recall that the dictionary abstract data type stores a collection of keys, and supports the operations insert, delete, and search. If the keys are totally ordered, then it can also support FindMin and FindMax. Suppose there are 1000 elements, each of which takes 16 bytes to store. Each element contains a key-value pair. Moreover, each pointer takes 4 bytes. In each case, (1) briefly describe the data structure and explain how the operations are imple- mented, and (2) analyze the exact space used (in bytes). (a) (4 pt) Suppose all the elements are given at the beginning, and there is no insertion or deletion afterwards. Only the search operation will be used later, and a good guarantee on the worst case search time is required. (b) (4 pt) Elements will be inserted and deleted frequently. The average running time for insert, delete and search is O(1), and on average at most. 5 elements are accessed for each operation. (c) (4 pt) All operations insert, delete and search are used frequently. A guarantee on the worst case running time (in terms of number of elements accessed) is needed. (d) (4 pt) Each key is an integer in (1,2,..., 100}. Each insertion or deletion has worst-case O(1) time. You may assume that each key appears at least once. Moreover, FindRange[a..b] needs to return all elements whose keys are in [a..b], where the running time is proportional to the number of elements returned. 2 Dictionary Abstract Datatype (16 points) Recall that the dictionary abstract data type stores a collection of keys, and supports the operations insert, delete, and search. If the keys are totally ordered, then it can also support FindMin and FindMax. Suppose there are 1000 elements, each of which takes 16 bytes to store. Each element contains a key-value pair. Moreover, each pointer takes 4 bytes. In each case, (1) briefly describe the data structure and explain how the operations are imple- mented, and (2) analyze the exact space used (in bytes). (a) (4 pt) Suppose all the elements are given at the beginning, and there is no insertion or deletion afterwards. Only the search operation will be used later, and a good guarantee on the worst case search time is required. (b) (4 pt) Elements will be inserted and deleted frequently. The average running time for insert, delete and search is O(1), and on average at most. 5 elements are accessed for each operation. (c) (4 pt) All operations insert, delete and search are used frequently. A guarantee on the worst case running time (in terms of number of elements accessed) is needed. (d) (4 pt) Each key is an integer in (1,2,..., 100}. Each insertion or deletion has worst-case O(1) time. You may assume that each key appears at least once. Moreover, FindRange[a..b] needs to return all elements whose keys are in [a..b], where the running time is proportional to the number of elements returned.
Expert Answer:
Answer rating: 100% (QA)
2 ANSWER GIVEN THAT a and b Hash Table Insertiondeletionsearch Average complexity constant ie O1 Wor... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
In Co-operators General Insurance Company v. Kane, 2017 BCSC 1720, Kane was sued for "unintentional battery assault". Could you help us to understand the meaning of unintentional battery assault?
-
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...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Bob Morin opened a medical practice specializing in surgery. During the first month of operation (August), the business, titled Bob Morin, Professional Corporation (P.C.), experienced the following...
-
A one-twelfth-scale model of an airplane is to be tested at 20C in a pressurized wind tunnel. The prototype is to fly at 240 m/s at 10-km standard altitude. What should the tunnel pressure be in atm...
-
In a discount interest loan, you pay the interest payment up front. For example, if a I-year loan is stated as $10,000 and the interest rate is 10%, the borrower "pays" .10 x $10,000 = $1,000...
-
What are the various types of pulley used for flat belt?
-
If elasticity is 2, price is $10, and marginal cost is $8, should you raise or lower price?
-
A child jumps from a moving sled with a speed of 2.2 m/s and in the direction opposite the sleds motion. The sled continues to move in the forward direction, but with a new speed of 5.5 m/s. If the...
-
Use the superposition principle to find io and vo in the circuit Fig. 4.79? Figure 4.79 For Prob. 4.11. 10 10 20 6 A 40 4 +30 V 10
-
Intro Your company bought a new machine for $35,000. The machine falls into the 7- year MACRS category: Year Depreciation rate 1 14.29% 2 24.49% 3 17.49% 4 12.49% 5 8.93% 678 8.92% 8.93% 8 4.46% Part...
-
2) An 80-kg Astronaut is training for arriving on a newly discovered planet, Planet X. This new planet has the same radius of earth but double the mass of earth. While training on Earth, the...
-
answer the following questions with the data provided. Show calculations by illustrating using the funnel model. Sales = 90 units/month (In flow) Production = 90 units/month (outflow) Backlog = 225...
-
a) Solve the equation cosh 3x = 2 b) Solve for x if 3 ln x + 4 log x = 1 c) Simplify the expression e2.7 e-3 (1.2) e d.p. and determine its numerical value to 3
-
Rolled up, rectangular, parallel plate capacitor filled with a dielectric material has capacitance C = 2.00 F, plate separation d = 0.100 mm, and its short rectangular side has length l = 3.00 cm. If...
-
You owe $20,000 in credit card debt. If the interest rate is 20% APR with monthly compounding and you are committed to making monthly payments of exactly $340, how long will it take you to pay this...
-
Find the limit without using L'Hpital's Rule. sin 2 lim 2-0 1- cos 2r
-
TRUE-FALSE QUESTIONS 1. In terms of preliminary analytical procedures, assume that the company has introduced a new product with a low price point and significant customer demand. The auditor would...
-
Find an asymptotic upper bound on the summation Llg n] E In/2*] . k=0
-
In this problem, we give pseudocode for three different algorithms. Each one takes a connected graph and a weight function as input and returns a set of edges T. For each algorithm, either prove that...
-
A certain string-processing language allows a programmer to break a string into two pieces. Because this operation copies the string, it costs n time units to break a string of n characters into two...
-
What is the relation between degrees Fahrenheit and degrees Rankine? And the relation between degrees Celsius and Kelvin?
-
State Newton's second law as you would apply it to a control mass.
-
Explain the significance of \(g_{c}\) in Newton's second law. What are the magnitude and units of \(g_{c}\) in the English Engineering system? In the SI system?
Study smarter with the SolutionInn App