Sequential search algorithm

¡Supera tus tareas y exámenes ahora con Quizwiz!

Step 6 (if step 2)

Set value of Found to yes

best case cost

1

Step 10 (after while if statement)

if found = no then

Step 4 (start of if)

if number is equal to the ith number on the list Ti, then

Step 8 (beginning of Else)

Else number is not equal to T

Step one: (get necessary variables)

Get values for Number T1... Tn, and N1 ..., Nn

Step two: (instantiate counter and boolean)

set the value of i to 1 and set the value of found to NO

Step 9 (increase counter)

Add one to the value of i

Step 3 (start of while)

While both (Found = no) and i<= n) do steps 4 through 7

worst case cost

n

Step 11 (body of second if)

print the message "not found"

Step 5 (if step 1)

print the name of corresponding person Ni


Conjuntos de estudio relacionados

Nursing Trends 4223 TEST 1 Updated

View Set

Advanced Practice Multiple Choice WEC 2 Test

View Set

Chapter 17: Integrating Network Devices

View Set

Overview of infectious diseases terms

View Set

Section 1.4 Credit and Debt (Borrowing)

View Set

Harry Potter, All about class of 2026, Spanish Learning

View Set

Periodic Table Choice Board - Who Am I?

View Set

FUNDS EAQ Exam 2 practice questions

View Set

Physical Science Ch.15 Sections 1 & 2

View Set

California Real Estate Law Ninth Edition 2019 Unit 5-8

View Set