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

  Find crc using modulo two arithmetic or polynomials

For a pattern P = 10011, and a message D = 10010011011, find, using modulo 2 arithmetic or polynomials, the CRC, then the string T to be transmitted.

  Explore and estimate software programs

Explore and estimate software programs based on following criteria: Needs assessment -- Why would the prospective user require program? Write down the features of the program?

  Business rules that are reflected in the erd

Write the business rules that are reflected in the ERD shown below. (Keep in mind that the ERD reflects some simplifications. For example, this ERD states that each book is only written by one author, but in reality, there are many books written by m..

  Write a program that reads the data in the file and displays

Write a program that reads the data in the file and displays the car number, miles driven, gallons used and the miles per gallon for each car.

  Generated by some condition that occurs as a result

Program: Generated by some condition that occurs as a result of an instruction execution, such as arithmetic overflow, division by zero, attempt to execute an illegal machine instruction, and reference outside a user's allowed memory space.

  Create the data model segment for business rules

The FlyRight Aircraft Maintenance (FRAM) division of FlyRight Company (FRC) does all maintenance for FRC's aircraft. Create the data model segment which reflects the following business rules.

  Determine access time when there is cache miss

Determine the access time when there is cache miss? Suppose that cache waits until line has been fetched from main memory and then re-executes for hit.

  Information assets to estimate for risk management

If organization has three information assets to estimate for risk management as shown in accompanying data, which vulnerability must be evaluated for additional controls first?

  Brainstorming skills to determine procedure to follow

The lead investigator gives you these graphics files and tells you that at least four messages should be embedded in them. Use your problem solving and brainstorming skills to determine a procedure to follow.

  Understanding of storage classes and scope rules

It amounts to a "divide and conquer" approach to problem solving. This needs sound understanding of storage classes and scope rules. Response and or thoughts?

  Determining smallest-last vertex ordering

Determine a smallest-last vertex ordering and plot degree when deleted diagram for given random geometric graphs.

  Explaining formal risk assessment of desktop systems

As apart of a formal risk assessment of desktop systems in small accounting firm with limited IT Support, you have identified asset "integrity of customer and financial data files on desktop systems" and threat.

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