Program that will implement a binary search

Assignment Help Basic Computer Science
Reference no: EM13163625

Write a program that will implement a binary search. You program should store 40 numbers. The 40 numbers will be initialed in an array (See Below). Your program should read in each number, call a binary search, and Indicate if the number is found and if so where or if it is not in the list. Your program should also print the number before the number that was found and the number. For example, if you search for 31, then your program should display that 31 was found and the number before it is 29 and the number after it is 33.
int list[20] { 1, 4, 5, 6, 9,11,14,17,19,20, 22, 24, 25, 29, 31, 33, 35, 38, 40, 43, 45, 47,49, 50, 51, 55, 57 , 59, 61 , 63, 67, 69, 70, 72, 74, 77, 79, 80, 85, 92 }.

Reference no: EM13163625

Questions Cloud

Recall that a computer virus is malware : Recall that a computer virus is malware that relies on someone or something (other than itself) to propagate from one system to another. Write a computer virus that can be written to other empty text documents by running the batch program.
Atmega128 is being used to monitor humidity inside test cham : Atmega128 is being used to monitor humidity inside test chamber 03. The device uses two sensors to have some fault tolerance. They are connected to ADC channels 0 and 1. The program uses the average and maximum error of the two values.
The time delay of a long-distance : The time delay of a long-distance call can be determined by multiplying a small fixed constant by the number of communication links on the telephone network between the caller and callee
Write a function to compute the magnitude f : write a function to compute the magnitude F and direction angle of a two-dimensional force F by using two components of the force fx,fy as its parameters,returning F and using the reference to pass theta value .
Program that will implement a binary search : Write a program that will implement a binary search. You program should store 40 numbers. The 40 numbers will be initialed in an array (See Below). Your program should read in each number, call a binary search, and Indicate if the number is found ..
Write a function to convert the two dimensional coordinates : write a function to convert the two dimensional coordinates of a point from cartesian system to polar system by using x and y as its parameters
Write a program that computes the amount of money : Write a program that computes the amount of money the computer club will receive from proceeds of their granola bar sales project. Allow the user to enter the number of cases sold and the sale price per bar. Each case contains 12 bars; each case is p..
Write a function to compute the volume of a cone : write a function to compute the volume of a cone by using the base radius r and the height h of the cone as the parameters of the function Vcone = xr^2h/3
Write a program that can be used to determine the tip amount : Write a program that can be used to determine the tip amount that should be added to a restaurant charge. Allow the user to input the total, before taxes and the tip percentage (15% or 20%). Produce output showing the calculated values including the ..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Runnig test cases on same piece of code

Why four people must waste their time looking for faults when one person can run test cases on same piece of code. How do you respond?

  Fork function

Create a C program that takes an integer argument from the command line and outputs sum of all digits of the integer. For example, the result of the invocation sum of digits 12345 should be fifteen.

  Investigation-woman having inappropriate files on computer

Young woman who was fired from her job for inappropriate files discovered on computer, and she swears she never accessed files. What questions must you ask and how should you proceed?

  Explain the key benefits that object-oriented programming

Explain the key benefits that object-oriented programming could afford the health care industry - Provide example that demonstrates the key manner in which the health care industry could implement functions.

  Explain effective site navigation from internet

Students will research the best practices for site navigation and locate the example of effective site navigation from Internet.

  Explain vulnerability in the system

How would you respond if Goli came to you describing a vulnerability in your system and offering to help fix it--What would incline you to hire her? What would disincline you from doing so?

  Construct resolution proofs to demonstrate truth

Can you construct resolution proofs to demonstrate the truth of each of these statements given the 5 facts listed above? Do so if possible.Otherwise add the facts you need & then construct the proofs.

  Each cycle in an instruction cycle

Suppose each cycle in an instruction cycle takes an average of 5 clock cycles. Determine the number of clock cycles needed to process 10 instructions without and with a pipeline

  Finding content of top of stack-call instruction is executed

Specify the content of PC, SP, and the top of the stack in the following situations: After the call instruction is executed.

  Explaining data-tlb hit and data-cache hit

Upon a load instruction, event "data-TLB hit" followed by "data-cache hit" is the most probable to occur among four possibilities of Cartesian product.

  Code scheme to meet marketing managers requirements

Design a code scheme that will meet the marketing managers stated requirements.

  Alter computation of prefix function-correctly match string

if ‘_' is wild-card, then pattern ‘foo*bar*nad' can be found in ‘foofoowangbarnad'. Alter computation of prefix function to correctly match strings using KMP.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd