1. If we insert the entries (1,A), (2,B), (3,C), (4,D), and (5,E), in this order, into an initially empty binary search tree, what will it look like?2. Insert, into an empty binary search tree,...
Recent Questions
Describe an efficient multimap structure for storing n entries whose r
The operation get(k) for our multimap ADT is responsible for returning a collection of all values currently associated with key k. Design a variation of binary search for performing this operation...
An inverted file is a critical data structure for implementing applications such an index of a book or a search engine. Given a document D, which can be viewed as an unordered, numbered list of...
Consider sets whose elements are integers in the range [0,N − 1]. A popular scheme for representing a set A of this type is by means of a boolean array, B, where we say that x is in A if and only if...
Give a concrete implementation of the retainAll method for the set ADT, using only the other fundamental methods of the set. You are to assume that the underlying set implementation uses fail-fast...
Suppose that each row of an n × n array A consists of 1’s and 0’s such that, in any row of A, all the 1’s come before any 0’s in that row. Assuming A is already in memory, describe a method running...
1. Describe how to modify the skip-list data structure to support the method median( ), which returns the position of the element in the “bottom” list S0 at index ⌊n/2⌋, Show that your...
1. Given a database D of n cost-performance pairs (c, p), describe an algorithm for finding the maxima pairs of C in O(nlogn) time.2. Show that the methods above(p) and before(p) are not actually...
Repeat Exercise C-10.51 for the ProbeHashMap classExercise C-10.51Give an alternative implementation of the SortedTableMap’s entrySet method that creates a lazy iterator rather than a snapshot. (See...
Describe an efficient multimap structure for storing n entries that have an associated set of r
1. Give an alternative implementation of the SortedTableMap’s entrySet method that creates a lazy iterator rather than a snapshot. (See Section 7.4.2 for discussion of iterators.)2. Repeat the...
Suppose we are given two sorted search tables S and T, each with n entries (with S and T being implemented with arrays). Describe an O(log2 n)-time algorithm for finding the kth smallest key in the...
Although keys in a map are distinct, the binary search algorithm can be applied in a more general setting in which an array stores possibly duplicative elements in nondecreasing order. Consider the...
Repeat Exercise C-10.45 for the ChainHashMap class.Exercise C-10.45Develop a location-aware version of the UnsortedTableMap class so that an operation remove(e) for existing Entry e can be...
1. Develop a location-aware version of the UnsortedTableMap class so that an operation remove(e) for existing Entry e can be implemented in O(1) time.2. Repeat the previous exercise for the...
The java.util.LinkedHashMap class is a subclass of the standard HashMap class that retains the expected O(1) performance for the primary map operations while guaranteeing that iterations report...
Redesign our ProbeHashMap class so that the sequence of secondary probes for collision resolution can be more easily customized. Demonstrate your new design by providing separate concrete subclasses...
The quadratic probing strategy has a clustering problem related to the way it looks for open slots. Namely, when a collision occurs at bucket h(k), it checks buckets A[(h(k) +i2) mod N], for i =...
Give an O(logn)-time solution for the previous problemExercise C-10.49Suppose we are given two sorted search tables S and T, each with n entries (with S and T being implemented with arrays)....
Describe how to perform a removal from a hash table that uses linear probing to resolve collisions where we do not use a special marker to represent deleted elements. That is, we must rearrange the...
A freight-hauling firm estimates that it will need a newforklift in six years. The estimated cost of the vehicle is$40,000. The company sets up a sinking fund that pays 8% compoundedsemiannually,...
Fred Corp is considering a project that has the following cashflow data. What is the project’s IRR? Not the a project’s projectedIRR can be less than the WACC or negative, in both cases...
FRB is targeting a 25-basis point increase in federalfunds from 0-25 bp tp 50bps in Dec 2015. How would you positionyour bank’s investment portfolio? what type of investments do youwant?
You have found a car at a car lot and in typical fashion areinvited into the office to “work a deal”. You know the price of thecar is $10,000 (which is what you need to borrow) and the...
i had my formula wrong in the last question. the formula is YTM= 2 x [(face amount / strips price)^1/2m – 1]2M=5, strips price =90.875 and face amount 100I just cant seen to come up with the...
A forklift will last for only 4 more years. It costs $6,500 ayear to maintain. For $20,000 you can buy a new lift that can lastfor 10 years and should require maintenance costs of only $3,500...
Some foreign policy analysts believe that the United Statesshould work closely with allies in order to achieve its foreignpolicy goals. Which of the following terms best describes thisapproach to...
Which of the following is not typically included amongthe three major components of a financial planning model?A. Inputs: current financial statements, forecasts of keyvariablesB. Planning model:...
A French utility seeks USD financing because it perceives theUSD as over-bought and because USD rates are lower than EUR rates.A British bankAc€?? active in the Eurocurrency marketAc€??...
Which of the following is a theory about the use of nuclearweapons?Select one:a. Detenteb. Bush Doctrinec. Mutually Assured Destructiond. Containment
Redesign the AbstractHashMap class so that it halves the capacity of the table if the load factor falls below 0.25. Your solution must not involve any changes to the concrete ProbeHashMap and...
1. Modify the ChainHashMap class in accordance with your design for the previous exercise.2. Modify the ProbeHashMap class in accordance with Exercise C-10.36.Exercise C-10.36Describe how to...
Describe how to redesign the AbstractHashMap framework to include support for a method, containsKey, as described in Exercise R-10.3.Exercise R-10.3The use of null values in a map is problematic, as...
Repeat Exercise C-10.33 for the ProbeHashMap class.Exercise C-10.33Consider the goal of adding entry (k,v) to a map only if there does not yet exist some other entry with key k. For a map M (without...
Repeat Exercise C-10.33 for the ChainHashMap class.Exercise C-10.33Consider the goal of adding entry (k,v) to a map only if there does not yet exist some other entry with key k. For a map M (without...
Consider the goal of adding entry (k,v) to a map only if there does not yet exist some other entry with key k. For a map M (without null values), this might be accomplished as follows.While this...
For an ideal compression function, the capacity of the bucket array for a hash table should be a prime number. Therefore, we consider the problem of locating a prime number in a range [M,2M]....
1. If we let n denote the size of set S, and m denote the size of set T, what would be the running time of the operation S.addAll(T), as implemented on page 446, if both sets were implemented using...
The java.util.HashMap class uses separate chaining, but without any explicit secondary structures. The table is an array of entries, and each entry has an additional next field that can reference...
Recent Comments