Question: Need help with this exercise using Java Exercise 1. Design a number (ID) generator system that generate numbers between 0-99999999 (8-digits). The system should support

Need help with this exercise using Java

Exercise 1. Design a number (ID) generator system that generate numbers between

Exercise 1. Design a number (ID) generator system that generate numbers between 0-99999999 (8-digits). The system should support two functions: a. int getNumber(); b. int requestNumber(); getNumber() function should find out a number that is not assigned, then marks it as assigned and return that number. requestNumber() function checks the number is assigned or not. If it is assigned returns 0, else marks it as assigned and return 1. Hint: You can keep a counter for assigning numbers. Whenever there is a getNumber() call you will check if that number is already assigned in a Hash-Table. If it is already assigned, then increase the counter and check again. If you find a number not in the Hash-Table then add it to Hashtable and increase the counter. requestNumber() will look in the Hash-Table, if the number is already present it return 0 else it will number as present inside the Hash-Table. What is the Time Complexity of the

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 Programming Questions!