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...
-
Gold Creek Mining Company has two competing proposals: a processing mill and an electric shovel. Both pieces of equipment have an initial investment of $846,778. The net cash flows estimated for the...
-
Fisher Company produces two types of components for airplanes: A and B, with unit contribution margin s of $400 and $600, respectively. The components pass through three sequential processes:...
-
How many edges are in a complete graph with 12 vertices? Use the given figure. Us Graph A = S U S Graph B U t Graph C S Graph D S
-
Henderson Office Supply is considering a more liberal credit policy to increase sales, but expects that 9 percent of the new accounts will be uncollectible. Collection costs are 6 percent of new...
-
2. Using the definition of derivative f'(xo) = lim f(xoth) - f(xo) h -+0 h compute f'(1) for: (a) f(x) = 5x2. (b) f (ac ) = Vx
-
(Each part of this problem is quite long and best worked by groups of students.) Peak intensities of the molecular ion region are listed in parts (a) - (g) and shown in the figure. Identify which...
-
Write a paper in which you identify at least 3 problems in a relationship you have been in or witnessed. Then, analyze and evaluate your position. You will need to do research and have four credible...
-
Explain THREE manufacturing processes involved in fabrication of a pressure vessels (from metals/alloys). Hint: Elaborate on specific techniques used for shaping and joining materials to ensure...
-
What type of sentence fault results when a writer punctuates a broken - off part of a complex sentence as if it were a complete sentence?
-
The trajectory of the object is not a straight line, its height h above the horizontal line depends on coordinate x. Find a function h(x) and plot over an interval [0, 10 m]. It is known that the...
-
Suppose the source of atoms in a Stern-Gerlach experiment was an oven of temperature 1010 K. Assume the magnetic field gradient to be 13 T/m, and take the length of the magnetic field region and the...
-
Which approach is not recommended when filling a gap in the leader - manager attributes of your team?
-
Gale Co. was formed on January 1, 2021 as a wholly owned foreign subsidiary of a U.S. corporation. Gale's functional currency was the stickle (). The following transactions and events occurred during...
-
Linda Lopez opened a beauty studio, Lindas Salon, on January 2, 2011. The salon also sells beauty supplies. In January 2012, Lopez realized she had never filed any tax reports for her business and...
-
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...
-
Identify the main users of accounting information for a university. For what purposes would different user groups need information? Would these groups use the accounting information in a different...
-
List the seven steps in the accounting cycle in the order in which they occur and explain what occurs at each step of the accounting cycle. LO18
-
Identify each of the following categories of accounts as temporary or permanent: assets, liabilities, equity, revenues, expenses, dividends declared. How is the distinction between temporary and...
Study smarter with the SolutionInn App