Docsity

Comic Book Characters: Sequential and Binary Searches Homework, Assignments of Computer Science

Toggle sidebar
bg1
Animal Man
Aquaman
Atom
Batman
Beast
Black Canary
Black Panther
Blue Beetle
Captain America
Catwoman
Colossus
Cyclops
Daredevil
Deathstroke
Doctor Fate
Doctor Strange
Elektra
Firestorm
Flash
Gambit
Ghost Rider
Green Arrow
Green Lantern
Hawkman
Hulk
Human Torch
Huntress
Iceman
Invisible Woman
Iron Fist
Iron Man
Lobo
Metamorpho
Mister Fantastic
Moon Knight
Nightcrawler
Nightwing
Phoenix
Plastic Man
Power Girl
Punisher
Question
Red Tornado
Robin
Rogue
Sandman
Shazam
She-Hulk
Silver Surfer
Spectre
Spider-Man
Starfire
Storm
Sub-Mariner
Supergirl
Superman
Swamp Thing
Thing
Thor
Vigilante
Wolverine
Wonder Woman
Zatanna
CS 111.002: CONCEPTS OF COMPUTER SCIENCE
SPRING 2008
HOMEWORK #4: SEQUENTIAL & BINARY SEARCHES
DUE DATE: MONDAY, MARCH 3, 2008 AT 2:00 PM
NAME: ______________________________________
1. Answer the following questions about the list of comic book characters at left.
(a) (1 point each) When using a sequential search, how many name compari-
sons must be made in order to locate the following comic book characters
in the list?
She-Hulk __________
Black Panther __________
(b) (1 point each) When using a binary search, how many name comparisons
must be made in order to locate the following comic book characters in the
list?
She-Hulk __________
Black Panther __________
(c) (1 point each) When using a sequential search, how many name compari-
sons must be made in order to determine that the following comic book
characters are not in the list?
Doctor Manhattan __________
Magneto __________
(d) (1 point each) When using a binary search, how many name comparisons
must be made in order to determine that the following comic book charac-
ters are not in the list?
Doctor Manhattan __________
Magneto __________
(e) (1 point) What is the largest
number of comparisons that could
be made when performing a se-
quential search of this list?
__________
(f) (1 point) What is the largest
number of comparisons that could
be made when performing a bi-
nary search of this list?
__________

Partial preview of the text

Download Comic Book Characters: Sequential and Binary Searches Homework and more Assignments Computer Science in PDF only on Docsity!

Animal Man Aquaman Atom Batman Beast Black Canary Black Panther Blue Beetle Captain America Catwoman Colossus Cyclops Daredevil Deathstroke Doctor Fate Doctor Strange Elektra Firestorm Flash Gambit Ghost Rider Green Arrow Green Lantern Hawkman Hulk Human Torch Huntress Iceman Invisible Woman Iron Fist Iron Man Lobo Metamorpho Mister Fantastic Moon Knight Nightcrawler Nightwing Phoenix Plastic Man Power Girl Punisher Question Red Tornado Robin Rogue Sandman Shazam She-Hulk Silver Surfer Spectre Spider-Man Starfire Storm Sub-Mariner Supergirl Superman Swamp Thing Thing Thor Vigilante Wolverine Wonder Woman Zatanna

CS 111.002: CONCEPTS OF COMPUTER SCIENCE

SPRING 2008

HOMEWORK #4: SEQUENTIAL & BINARY SEARCHES

DUE DATE: MONDAY, MARCH 3, 2008 AT 2:00 PM

NAME: ______________________________________

  1. Answer the following questions about the list of comic book characters at left. (a) (1 point each) When using a sequential search, how many name compari- sons must be made in order to locate the following comic book characters in the list? She-Hulk __________ Black Panther __________ (b) (1 point each) When using a binary search, how many name comparisons must be made in order to locate the following comic book characters in the list? She-Hulk __________ Black Panther __________ (c) (1 point each) When using a sequential search, how many name compari- sons must be made in order to determine that the following comic book characters are not in the list? Doctor Manhattan __________ Magneto __________ (d) (1 point each) When using a binary search, how many name comparisons must be made in order to determine that the following comic book charac- ters are not in the list? Doctor Manhattan __________ Magneto __________

(e) (1 point) What is the largest number of comparisons that could be made when performing a se- quential search of this list?


(f) (1 point) What is the largest number of comparisons that could be made when performing a bi- nary search of this list?