1. Given the following array arr1[] then answer the question below: 591 17 11 6 20...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Given the following array arr1[] then answer the question below: 591 17 11 6 20 19 38 6 3 4 5 7 8 0 4 2 2 9 a) Arri[4]= arr1 [2]+arr1[3] b) Arr1[5] /2=? c) Apply linear search to find if 11 exist in arr[] (show the steps) 2. Given the following array arr2[] then answer the question below: 7 10 22 24 31 38 42 46 68 72 10 2 0 1 2 3 4 5 6 7 8 9 a) Apply binary search to find if 72 exist in arr2[] (show the steps) b) Apply binary search to find if 1 exist in arr2[] (show the steps) 3. What is the time complexity of a binary search and linear search in best and worst cases? 4. Which will cause the shortest execution of a binary search and linear search? 5. If you had an ordered array of size 500, what is the maximum number of iterations required to find an element with binary search? 6. If you had an ordered array of size 500, what is the maximum number of iterations required to find an element with linear search? 7. What are the termination condition for binary search and linear search? 10 11 1. Given the following array arr1[] then answer the question below: 591 17 11 6 20 19 38 6 3 4 5 7 8 0 4 2 2 9 a) Arri[4]= arr1 [2]+arr1[3] b) Arr1[5] /2=? c) Apply linear search to find if 11 exist in arr[] (show the steps) 2. Given the following array arr2[] then answer the question below: 7 10 22 24 31 38 42 46 68 72 10 2 0 1 2 3 4 5 6 7 8 9 a) Apply binary search to find if 72 exist in arr2[] (show the steps) b) Apply binary search to find if 1 exist in arr2[] (show the steps) 3. What is the time complexity of a binary search and linear search in best and worst cases? 4. Which will cause the shortest execution of a binary search and linear search? 5. If you had an ordered array of size 500, what is the maximum number of iterations required to find an element with binary search? 6. If you had an ordered array of size 500, what is the maximum number of iterations required to find an element with linear search? 7. What are the termination condition for binary search and linear search? 10 11
Expert Answer:
Answer rating: 100% (QA)
1 Given the following array arr1 arr1 5 01 a Arr14 arr12 arr13 Since arr12 and arr13 are not defined it is not possible to evaluate this expression b Arr152 Since arr15 is not defined it is not possib... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
In order to build the Randolph Student center, Fayetteville State University had to remove the old student center building. To accomplish this, Fayetteville State University hired Seven Men...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The article "Estimating Resource Requirements at Conceptual Design Stage Using Neural Networks" (A. Elazouni, I. Nosair, et al., Journal of Computing in Civil Engineering, 1997:217-223) suggests that...
-
Outline suggestions to make observation a useful, reliable requirements elicitation technique.
-
When water at 20C ( = 998 kg/m3, = 0.001 kg/ms) flows through an 8-cmdiameter pipe, the wall shear stress is 72 Pa. What is the axial pressure gradient ( p/ x) if the pipe is (a) horizontal; and (b)...
-
The following unadjusted trial balance is available for Tenfour Trucking Company on January 31, 2016: Required 1. Enter the unadjusted trial balance in the first two columns of a ten column work...
-
Which is not a physical property of a material? (a) Density (b) refractive index (c) Roughness (d) Thermal expansion
-
Refer to the data in Exercise 3- 24A. Altons accountant found an error in the expense records from the year reported. Depreciation on manufacturing plant and equipment was actually $ 400,000, not the...
-
If individual values that underline ethics are developed at a young age, what might this suggest about the potential for ethical conflicts to arise within an organization?
-
The propeller in Prob. 9.1 is replaced with a six-blade turbine 400 mm in diameter, and the fluid to be agitated is a pseudoplastic power law liquid having an apparent viscosity of 15 P when the...
-
Mass air flow (MAF) sensors are designed to work with other temperature and pressure sensors in the intake circuit. This allows the PCM to compensate for four [4] changing conditions such as?
-
A 0.425-kg mass is attached to a spring of force constant 134.25 N/m and rests on a horizontal, frictionless surface as shown in the figure below. You apply a horizontal force to the mass that causes...
-
How do executive-level decisions affect organizational change? How should an executive cast vision for a major change? For example, when an executive wants to execute change in the organization, what...
-
Marisa wants to buy a home in Atlanta with a 30-year mortgage that has an annual interest rate of 4.9%. The house she wants is $250,000, and she will make a $55,000 down payment and borrow the...
-
A bond is currently trading at $952.31. The bond has a face value of $1,000, a coupon rate of 8% with payments made semi-annually, and mature in 20 years. What is the yield to maturity? ( Company A's...
-
A force is given as F=-yzi -xzj-xyk (a) Show that this force is conservative. (b) Calculate the corresponding potential energy V as a function of x, y, and z. (c) Show that the mechanical energy E...
-
For a specimen of soil, the following are obtained: - Wet weight: 340 g. - Dry weight: 230 g. - Wet volume: 210 cc. - Specific gravity: 2.75. Calculate: - Void ratio. - Porosity. - Degree of...
-
Time Solutions, Inc. is an employment services firm that places both temporary and permanent workers with a variety of clients. Temporary placements account for 70% of Time Solutions' revenue;...
-
On September 14, 2012, Jay purchased a passenger automobile that is used 75 percent in his accounting business. The automobile has a basis for depreciation purposes of $35,000, and Jay uses the...
-
Sophie is a single taxpayer. For the first payroll period in October 2012, she is paid wages of $3,250 monthly. Sophie claims three allowances on her Form W-4. a. Use the percentage method to...
-
Frank, age 35, and Joyce, age 34, are married and file a joint income tax return for 2012. Their salaries for the year total $83,000 and they have taxable interest income of $4,000. They have no...
-
Obtain the time variation of the lift and propulsive force coefficients and their plots for the airfoil given by Example 8.5. Assume that the profile pitches about quarter chord point. Example 8.5...
-
Write down a numerical solution algorithm for the LU decomposition solution of the pseudo penta diagonal matrix equation given by (A11.4). A11.4 || B C 2 A2 B2 C2 922 An-1 Bn-1 Cn-1 -1 An Bn R R Rn-1...
-
Obtain Eq. 8.66 as a relation between the wake vorticity and the reduced circulation. Eq. 8.66 w(x) = k(Q; cosx-22, sin x) cos ks +k(Q; sin x+Q, cos x) sinks, Q = Q, +Q;i
Study smarter with the SolutionInn App