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 small disc A is placed on an inclined plane forming an angle a with the horizontal (Fig.) and is imparted an initial velocity vo. Find how the velocity of the disc depends on the angle if the...
-
Microchip began the year with $2,600 in its asset account, supplies. During the year, $7,100 in supplies were purchased and debited to supplies. At year-end, supplies costing $3,550 remain on hand....
-
An explosion in an LNG storage tank in the process of being repaired could have occurred as the result of static electricity, malfunctioning electrical equipment, an open flame in contact with the...
-
Suppose you manage Outward Bound, Inc., a Vermont sporting goods store that lost money during the past year. To turn the business around, you must analyze the company and industry data for the...
-
Microsoft wins on Innovation why you believe this brand is winning? What are they doing right? Is this something that has changed or have they always been "good/bad" in this area? Is this a brand...
-
1. How will you characterize Tupperwares distribution strategy in relation to the theoretical models? 2. What are the advantages and disadvantages of Tupperwares distribution model? 3. How do you...
-
1) What is the importance of the central bank? 2) Describe central bank independence and its importance?
-
explain step by step and include each formula used: A sample of the radioactive carbon isotope has a mass of 0.500 g. The decay constant of this carbon nuclide is 0.03554 s1. Calculate the activity...
-
1. Build the full-wave bridge rectifier circuit as shown below in the LTSpice. 2 Vin D4 D2 D1 D3 a. Add net names to the input and the output of the circuit as shown in the figure. b. D1-D4 are...
-
Jones Manufacturing Inc. sponsored a defined benefit pension plan effective 1 January 20X7. The company uses the projected unit credit actuarial cost method for funding and accounting. Long-term...
-
Supply chain network evaluation for products A and B that are produced in various regional manufacturing facilities of the same company. You have a team supporting your evaluation of procurement,...
-
Solve the following DE d?x dt2 + kx = f(t) (i) d?Q dQ (ii) + R dt2 = f(t) dt Hints: Step 1: First, express x, q(t) and f(t) as fourier series under different summation index e.g. I, m on each side...
-
CL 2-123. A book contains an average of 300 words per page. If you read one page in 68 seconds, what is your reading rate in words per minute? In pages per hour? Words per minute? (Start with a ratio...
-
Do animals have rights? If so, what are they? What duties do human beings have toward animals? Does KFC protect animal welfare at an acceptable level?
-
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...
-
True or False: When multiple independent, divisible investments are available, form the investment portfolio so that the internal rate of return is maximized.
-
Polaris Industries has \(\$ 1,250,000\) available for additional innovations on the Victory Vision motorcycle. These include the five indivisible, equal-lived alternatives, each of which guarantees...
-
Consider a capital budgeting formulation where the binary variables \(x_{1}\) and \(x_{2}\) are used to represent the acceptance \(\left(x_{i}=1 ight)\) or rejection \(\left(x_{i}=0 ight)\) of each...
Study smarter with the SolutionInn App