The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
1. What is the largest number of entries that are interrogated if the binary search algorithm (Figure 5.14) is applied to a list of 4000names? How does this compare to the sequential search (Figure 5.6)?

Figure 5.14 The binary search algorithm in pseudocode
procedure Search (List, TargetValue)
if (List empty)
then
(Report that the search failed.)
e l se
[Select the "middle" entry in List to be the TestEntry;
Execute the block of instructions below that is
associated with the appropriate case,
case 1: TargetValue = TestEntry
(Report that the search succeeded.)
case 2: TargetValue < TestEntry
(Apply the procedure Search to see if TargetValue
is in the portion of the List preceding TestEntry,
and report the result of that search.)
case 3: TargetValue > TestEntry
(Apply the procedure Search to see if TargetValue
is in the portion of List following TestEntry
and report the result of that search.)
2. Use big-theta notation to classify the traditional grade school algorithms for addition and multiplication. That is, if asked to add two numbers each having n digits, how many individual additions must be performed. If requested to multiply two n-digit numbers, how many individual multiplications are required?
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- Th-----------ank----------- Yo-----------u f-----------or -----------usi-----------ng -----------our----------- we-----------bsi-----------te -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill-----------