Question: Consider the following problem: Given an array of integers, possibly with duplicates, we want to count the number of distinct integers contained in the array

 Consider the following problem: Given an array of integers, possibly with

Consider the following problem: Given an array of integers, possibly with duplicates, we want to count the number of distinct integers contained in the array Write an algorithm (in pseudocode) which solves this problem USING A HASH TABLE. (Do NOT use sorting.) Your algorithm should use the hash table operations, Initialize, Insert, Retrieve and Member. Input to your algorithm is an array A and the size n of the array. The algorithm returns the number of distinct integers contained in the array. Assume your hash table has size at least 2n. Analyze the EXPECTED asymptotic running time of your algorithm on an array. Justify your running time analysis. Assume your hash table has size at least 2n. Analyze the WORST CASE running time of your algorithm on an array. Justify your running time analysis

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!