answersLogoWhite

0

How do i write a program in c langua ge for the implementation of binary search with output?

send your answer with source code and output for pratical

User Avatar

Wiki Member

Lvl 1
5y ago
Updated: 12/21/2022

There are various ways to implement a binary search, but the simplest makes use of a sorted array. It must be sorted because we need to know where values are in relation to one another. That is, if we know that element X has the value Y, then all values less than Y must be in the first half of the array, and all values greater than Y must be in the second half of the array.

We begin by looking at the middle element of the array. If there is no middle element (the array is empty) then the value does not exist. But if the middle value holds the value we are looking for, we are done. Otherwise we compare values to decide which half of the array can be eliminated. We then repeat the process with the remaining half of the array.

User Avatar

Anonymous

4y ago

What else can I help you with?

Related Questions

What is the output of the following signed binary addition 10101011 10010011?

When decoded, that binary says: «“


Is binary code an input or output device?

Binary code is not a device. It is a numerical representation of data.


What is the greatest output current value from an8-bit input DAC that has an output of 4.5mA when the input binary number is 101101010110?

Output is be maximum when input binary number is 111111111111 and that value comes around 6.35mv.


What is accuracy of a good program?

It depends on to what level of accuracy you tend to have with the output of your program Accuracy can be treated as: (Desired Output / Actual Output of your Program)


What is the device that produces a single binary output based on one or more binary inputs?

Logic gate


How do you find the product of 16?

"Product" is a binary operator. A binary operator takes two numbers as input and combines them into an output. Your question gives only one number as input and so a sensible answer is impossible. "Product" is a binary operator. A binary operator takes two numbers as input and combines them into an output. Your question gives only one number as input and so a sensible answer is impossible. "Product" is a binary operator. A binary operator takes two numbers as input and combines them into an output. Your question gives only one number as input and so a sensible answer is impossible. "Product" is a binary operator. A binary operator takes two numbers as input and combines them into an output. Your question gives only one number as input and so a sensible answer is impossible.


Is a binary code an input or output device?

Binary code is not a device. It is a numerical representation of data.


In a bms system starting and stopping of a piece of equipment is through what type of point analog input analog output binary input or binary output?

In a BMS system, starting and stopping of a piece of equipment is through analog input analog output points.


What is hello world?

Hello world is the canonical program that all programming languages use to introduce new programmers to the language. The program simply prints the text "Hello world" via console output and helps programmers quickly identify the key difference in each specific language's implementation of that program.


Which documentation is typically written first input output internal program or external program?

Output documentation


What is the function of the NOT logic gate?

The NOT gate is also called an "inverter", as its output is always the complement of the input. That is, if the input is TRUE then the output is FALSE else the output is TRUE end if). Its implementation electronically is not much different than that of an analog inverting amplifier, except that the gate is deliberately designed to operate nonlinear and change rapidly from one state to another.


How do you convert c program as exc file?

There's no need to "convert" it. "C programs" don't do anything until they are compiled. If you are compiling it on a Windows computer, the compiler will generally output the binary in the form of an .exe file.