Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The sequential search algorithm of Figure 2.13 doesn't work when the numbers in the reverse directory are not unique. For example, if Raj is listed
The sequential search algorithm of Figure 2.13 doesn't work when the numbers in the reverse directory are not unique.
For example, if Raj is listed with a number of 1234 and Maria also has the number 1234, the algorithm would only print the first person found and then stop.
Modify the algorithm so that it prints EVERY occurrence of NUMBER in the directory along with the name (Both Raj and Maria would print).
2) (2 points)
Modify your improved algorithm from #1 so that it also prints out the number of occurrences found. (In the case of Raj and Maria sharing the number 1234, the algorithm would print that there were 2 occurrences)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started