Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2 3 ( Mandatory ) ( 1 point ) Thirty ( 3 0 ) students registered for a field trip. When the bus arrives,
Question Mandatory point
Thirty students registered for a field trip. When the bus arrives, the students randomly line up to board the bus, but their teacher needs to take attendance using a list containing the students names. The student names are in alphabetical order by last name. Two different algorithms are given for finding each student's name as they board the bus.
tableAlgorithm Algorithm Repeat until the name is found or until,Let the current name be the first nameyou run out of names in the list:,on the list.Repeat until you find the name in the list,Look at the middle name in the list,or reach the end of the list.If the name in the list is too high,,If the current name matches thestudents name,Cut off the top half of the list.,Mark the student present and stop.If the name in the list is too low,,Cut off the bottom half of the list.,Otherwise, make the current name theIf the name in the list matches the,next name in the list.students name,,Mark the student present.,
Algorithm A always finds the student's name, but Algorithm B does not.
Algorithm B always finds the student's name, but Algorithm A does not.
Both Algorithm A and always finds the students name
Neither Algorithm A nor Algorithm B finds the students name.
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