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: 90% (10 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?
-
524 Compartag Traditional Casting and Activity Based Costing Despolio proceso de offered the way we w The Deel verftet werded to the very prowing in the model habe icre is also they protihlube de The...
-
What is collaboration? LO.1
-
The following information was extracted from the December 31, 2011, current asset section of the balance sheets of four different companies: There were no transaction in short-term equity securities...
-
Quantitative Problem: Assume that interest rate parity holds. In the spot market 1 Japanese yen = $0.01, while in the 180-day forward market 1 Japanese yen = $0.0104. 180-day risk-free securities...
-
ZED plc manufactures one standard product, which sells at ?10. You are required to:(a) Prepare from the data given below, a break-even and profit?volume graph showing the results for the six months...
-
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",...
-
Imagine that domestic and foreign currency bonds are imperfect substitutes and that investors suddenly shift their demand toward foreign currency bonds, raising the risk premium on domestic assets...
-
Give an example of a program that will cause a branch penalty in the three-segment pipeline of Sec. 9-5. Example: Three-Segment Instruction Pipeline A typical set of instructions for a RISC processor...
-
Are Google, Microsoft, and Apple acting ethically? Are they being socially responsible? Eager to benefit from the economic growth and the job creation that foreign direct investments generate, many...
-
On May 1, 2011, Lenny's Sandwich Shop loaned \$20,000 to Joe Lopez for one year at 6 percent interest. Required Answer the following questions: a. What is Lenny's interest income for 2011? b. What is...
-
Tipton Corporations balance sheet indicates that the company has \($300,000\) invested in operating as sets. During 2006, Tipton earned operating income of \($45,000\) on \($600,000\) of sales....
-
Norton Car Wash Co. is considering the purchase of a new facility. It would allow Norton to increase its net income by \($90,000\) per year. Other information about this proposed project follows:...
-
In this project, you actually become the statistician. (a) Select a project of interest to you in which data must be collected. (b) Write a proposal and submit it to your instructor for approval. In...
-
Define relevant costs and discuss: (1) whether all future costs are relevant for decision making and (2) whether variable costs are always relevant and fixed costs are always irrelevant
-
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?
-
Eye Deal Optometry leased vision - testing equipment from Insight Machines on January 1 , 2 0 2 4 . Insight Machines manufactured the equipment at a cost of $ 2 0 0 , 0 0 0 and lists a cash selling...
-
help! ee all photos + Add to o e D C N X Edit & Create Share Table of Contents No sales to an individual customer accounted for more than 10% of revenue during any of the last three fiscal years. Net...
-
Business law A person may have the liability of a partner even though no partnership exists True False
Study smarter with the SolutionInn App