Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8. Consider the following problem: Let A be an array of records where each record contains two members: . A student id number . A

image text in transcribed
8. Consider the following problem: Let A be an array of records where each record contains two members: . A student id number . A class section number; Array A represents all the students and the classes they are taking in a given semester at OSU (Oregon State University). Given array A and a positive integer I we wish to compute the total number of students in each class section and then report the NUMBER of classes with more than I students in the semester represented by A. (a) 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, Member and Add. Input to your algorithm is array A, the size n of array A, and a positive integer I. The algorithm returns the NUMBER of classes with more than I students in the semester represented by A. (b) Assume your hash table has size at least 2n. Analyze the asymptotic EXPECTED running time of your algorithm on an array Justify your running time analysis. (You can assume either chained hashing or open address hashing.) (c) 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. (Note that the worst case time for insertion/find in a hash table is different than the expected case time. The difference between the worst case and expected times of insertion/find in the hash table will affect the worst case and expected times of your algorithm. You can assume either chained hashing or open address hashing.) 8. Consider the following problem: Let A be an array of records where each record contains two members: . A student id number . A class section number; Array A represents all the students and the classes they are taking in a given semester at OSU (Oregon State University). Given array A and a positive integer I we wish to compute the total number of students in each class section and then report the NUMBER of classes with more than I students in the semester represented by A. (a) 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, Member and Add. Input to your algorithm is array A, the size n of array A, and a positive integer I. The algorithm returns the NUMBER of classes with more than I students in the semester represented by A. (b) Assume your hash table has size at least 2n. Analyze the asymptotic EXPECTED running time of your algorithm on an array Justify your running time analysis. (You can assume either chained hashing or open address hashing.) (c) 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. (Note that the worst case time for insertion/find in a hash table is different than the expected case time. The difference between the worst case and expected times of insertion/find in the hash table will affect the worst case and expected times of your algorithm. You can assume either chained hashing or open address hashing.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago