How many passes are made through the While loop? The following pseudocode used to perform a binary
Question:
How many passes are made through the While loop?
The following pseudocode used to perform a binary search of the names "Arnold", "Draper", "Gomez", "Johnson", "Smith", "Wong" (stored in Array), for the name "Gomez". (Assume the array and all the variables have already been declared with their appropriate data types.)
Transcribed Image Text:
Set N = 5 Set Key "Gomez" Set Low Set High = N Set Index Int (N/2) Set Found While (Found == 0) AND (Low <= High) If Key Array [Index] Then %3D%3D Set Found = 1 End If If Key > Array[Index] Then Set Low = Index + 1 Set Index = Int((High + Low)/2) End If If Key < Array[Index] Then Set High = Index - 1 Set Index = Int((High + Low)/2) End If End While
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 87% (8 reviews)
Answered By
Nazrin Ziad
I am a post graduate in Zoology with specialization in Entomology.I also have a Bachelor degree in Education.I posess more than 10 years of teaching as well as tutoring experience.I have done a project on histopathological analysis on alcohol treated liver of Albino Mice.
I can deal with every field under Biology from basic to advanced level.I can also guide you for your project works related to biological subjects other than tutoring.You can also seek my help for cracking competitive exams with biology as one of the subjects.
3.30+
2+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
How many passes are made through the outer For loop? The following pseudocode, which is used to perform a selection sort in ascending order on the names "Wong", "Smith", "Johnson", "Gomez", "Draper",...
-
The Wilcoxon signed-rank test can be used to perform a hypothesis test for a population median, , as well as for a population mean, . Why is that so?
-
Which group function can be used to perform a count that includes NULL values?
-
The manufactured wood beam carries a uniformly distributed load of in- tensity wo. Determine the largest safe value of wo if the maximum shear stress in the wood is limited to 300 psi. 1.0 ft Wo 4 ft...
-
What are the four basic elements that must be contained in the complaint?
-
By what criteria do you think managers judge selection models? What criteria should they use?
-
A university graduate student has extracted the following trial balance. The amounts are correct per the ledger accounts, but entered under their incorrect headings of debit balances or credit...
-
Figure is an idealized schematic drawing of a rail gun. Projectile P sits between two wide rails of circular cross section; a source of current sends current through the rails and through the...
-
Investment Project Initial Investment (in thousands) Annual Cash Flows (in thousands) Project A $500 $150 Project B $800 $200 Calculate the ROI for each investment project and recommend the more...
-
Consider the following 0x86 program: .data array DWORD 1,2,3,4,5,6,7,8,9 aravSize -(S-array)/4 ; array .code main PROC mov ecx,arraySize-1 mov esi.OFFSET array L1: mov eax. [esi] sda mov bx,2 idiv bx...
-
After the While loop is exited, what is the value of Found? The following pseudocode used to perform a binary search of the names "Arnold", "Draper", "Gomez", "Johnson", "Smith", "Wong" (stored in...
-
After the first pass through the While loop, what are the values of Low and High? The following pseudocode used to perform a binary search of the names "Arnold", "Draper", "Gomez", "Johnson",...
-
Analyzing changes in accounts receivable, Braskem S.A., a large Brazilian petrochemical company, reported a balance of R$1,594.9 million in Accounts Receivable at the beginning of 2007 and R$1,497.0...
-
Mr. Brown and Mr. Black own cleaning companies.They are considering renting a small sweeper to share between their two separate businesses.Mr. Brown requires the machine for a total of 900 hours and...
-
Tony Hawk Inc. (Hawk) is a wholesale distributor supplying moderately priced sporting equipment to large chain stores.Hawk manufacturers and sells 20,000 tackle boxes annually, making full use of its...
-
3. [8 Marks]. Differentiate each of the following: (a) y = 10* (b) y = 43x (c) y = (x4)2x (d) y = 5x x
-
Find the output import java.util.*; public class DebugFive4 { public static void main (String args[]) { Scanner input = new Scanner(System.in); int one, two, three, four; String str, output;...
-
Firm A Revenues and Costs (thousands of dollars) 280 Total Revenues Total Costs 240 Firm B Revenues and Costs (thousands of dollars) 280 Total Revenues Total Costs 240- 200 200 Breakeven Point (30,...
-
Trace the execution of the following JavaScript statements and try to predict their behavior. For each assignment, fill in the values of the variables in their corresponding boxeseven those values...
-
Explain the buyers position in a typical negotiation for a business. Explain the sellers position. What tips would you offer a buyer about to begin negotiating the purchase of a business?
-
How is an STS multiplexer different from an add/drop multiplexer since both can add signals together?
-
What type of topology is used when customers in an area use DSL modems for data transfer purposes? Explain.
-
What is the relationship between STS signals and OC signals?
-
It's important to know the unmodified report and the different modified reports for the audit of financial statements. You must also recognize situations that would require a modified opinion....
-
Practice assignment Problem 4 Payroll Liabilities 2 Journal Entries Below is payroll information for Glaser Company for the pay period ending. September 30th Prepare the 2 Journal entries needed...
-
Since 1981, family-owned Southern Tool has grown into the ultimate destination for hard working do-it-yourselfers and professionals. Southern Tool Corporation has two divisions: Hand Tools and Power...
Study smarter with the SolutionInn App