Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 3 ( Mandatory ) ( 1 point ) Thirty ( 3 0 ) students registered for a field trip. When the bus arrives,

Question 23(Mandatory)(1 point)
Thirty (30) 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.
\table[[Algorithm 1,Algorithm 2],[Repeat until the name is found or until,Let the current name be the first name],[you 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 the],[student's 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 the],[If the name in the list matches the,next name in the list.],[student's 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 B always finds the students name
Neither Algorithm A nor Algorithm B finds the students name.
image text in transcribed

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

Advances In Spatial And Temporal Databases 8th International Symposium Sstd 2003 Santorini Island Greece July 2003 Proceedings Lncs 2750

Authors: Thanasis Hadzilacos ,Yannis Manolopoulos ,John F. Roddick ,Yannis Theodoridis

2003rd Edition

3540405356, 978-3540405351

More Books

Students also viewed these Databases questions