what is meant by binary search?

Answers were Sorted based on User's Feedback



what is meant by binary search?..

Answer / kiran

Record split into 2 halfs

compare last value of 1st half and 1st value of 2nd half

ex
we have 100 numbers
if we give 58

1-50 51-100
1st half second half

it ill check the last value of 1st half it is 50 and 1st
value of 2nd half it is 51

so it ill omit 1st half contains 1-50

again 51-100 split in 2 halfs

51-75 75-100
1st half 2nd half


it ill check the last value of 1st half it is 75 and 1st
value of 2nd half it is 100

so it ill omit 2nd half contains 75-100

like that process ill continue upto we get desired element

plz correct if i m worng

Is This Answer Correct ?    9 Yes 1 No

what is meant by binary search?..

Answer / rohit

hi kiran ... on the last you are comparing wrong values ...
that is last value of first half 75 and first value of 2nd
half 100 (it should be 76)..... please correct ....

Is This Answer Correct ?    2 Yes 0 No

what is meant by binary search?..

Answer / srikanth doki

Binary search is also known as search all.
For large tables with more than 10 records this search is
used. The records must be either in ascending or descending
order. First it will divide it into two parts and then it
will search for the center one if it not match then it will
search for the left or right half most ones.

Is This Answer Correct ?    2 Yes 0 No

what is meant by binary search?..

Answer / sumankumar

IT MEANS DATA SPLIT INTO 2 HALFS AND COMPARE FIRST HALF LAST
VALUE AND SECOND HALF FIRST VALUE WITH GIVEN DATA THEN
ELIMINATE HALF OF THE DATA AND AGAIN SPLIT INTO NEXT 2 HALFS
THIS PROCCESS WILL BE CONTINUED STILL VALUE IS IDENTIFIED

LET ME KNOW ONE EX:
PROGRAM: CONSIDER 1,2,3,4,5,6,7,8,9,10.
SET I TO 2
SEARCH ALL DATA
AT END DISPLY " EOT"
WHEN DATA(I)= 4
END-SEARCH ALL

SOL: THE DATA DIVIDE INTO 2 HALFS 1 TO 4, 5 TO 10 U R
REQUIREMENT IS SERCH AT POSITION OF 4 SO IT COMPARE FIRST
HALFS OF LAST VALUE i'e 4 AND SECOND HALFS OF FIRST VALUE
i'e 5 AND ELIMINATE THE HALF OF DATA AND AGAIN SPLIT IT INTO
NEXET 2 HALFS THIS PROCCESS WILL BE CONTINUED STILL VALUE IS
IDENTIFIED

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More COBOL Interview Questions

) how do u code after getting data?

0 Answers   IBM,


Name the divisions in a COBOL program ?

7 Answers  


How do we get current date from system with century?

2 Answers  


How can we know that cobol program is using report file or simple file....?

4 Answers  


What is the difference between next sentence and continue in cobol programing language?

0 Answers  


COMPUTE X = A * B - C * D and COMPUTE X = (A * B) - (C * D) (a) Are not the same (b) Are same (c) Syntactically wrong (d) Will yield a run time error

1 Answers   TCS,


Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?

6 Answers   ABC, IBM, Mphasis, Wipro,


how the control comes back from subprogram to mainprogram

3 Answers   IBM,


What are the pertinent COBOL

0 Answers   IBM,


SIGN TRAILING SEPARATE field occupy ?

3 Answers  


What is the mode in which you will OPEN a file for writing?

4 Answers  


I have a Flat file in which certain records are present in a tabular format. I need to extract some of the records on some basis from it and copy them into a flat file...how it can be done ??

2 Answers   HCL,


Categories