Answered step by step
Verified Expert Solution
Link Copied!

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)
image text in transcribed
on. @The Sequentia LA-Assignment /DInvitation toexeSharedwith mGw y/Downloads/GMichael%20Schneider%20Judith%20Gersting-Invitation%20to%20Computer%20Science-Cour Chapter 2Algorithm 1 FIGURE 2.13 Step Operation 1Get values for NUMBER., Thoao and N,.N.00 Set the value of i to 1 and set the value of Found to NO While botdFound = NO)and (i 10,000) do Steps 4 through 7 If NUMBER is equal to the ith number on the list, T, then Print the name of the corresponding person, N Set the value of Found to YES Else (NUMBER is not equal to T) Add 1 to the value of i 7 8 If (found = NO)then Print the message Sis umber is not in the direc 10 Stop The sequential search algorithm (which is not actually a valid telephone number according to the North American Numbering Plan that covers the United States, Canada, and many Caribbean islands). In all likelihood, a communications company located in

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

Step: 3

blur-text-image

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions