Question: Problem 3 : ( 8 points total. Show all work for partial credit - use the back of this page as needed. ) Tags labeled

Problem 3: (8 points total. Show all work for partial credit - use the back of this page as needed.)
Tags labeled with distinct ID#s are stored in 31 bins. The ID#s are sorted in ascending order.
\table[[p= Bin#,1,2,3,4,5,6,7,dots,1301,31],[Tag ID #,101,105,106,112,117,122,124,dots,197,199]]
A robot searches the 31 bins for a target tag ID# using the following algorithm.
Step 0: Set k to 16.
Step 1: Move right by k bins.
Step 2: Pick up current tag.
Step 3: Compare current tag ID# to target ID#.
Step 4: If target ID# is equal to current tag ID#:
Turn on light to indicate that target was found. Stop.
// comment: Else continue on to Step 5
Step 5: Put back the current tag.
Step 6: Replace k with k/2.
Step 7: If target ID# is less than current tag ID#:
Move left by k bins
Else if target ID# is more than current tag ID#:
Move right by k bins
Repeat from Step 2.
(a) How many Steps are needed if the target tag ID# is equal to the tag ID# in Bin 10?
(b) What is the maximum number of Steps needed for the robot to find a target tag in the bins? Give an example of a position that uses that maximum number of steps.
Problem 3 : ( 8 points total. Show all work for

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!