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

C1 C2 C3 are three conditions whose TRUTH values are as folloes. C1-TRUE C2-FALSE C3-TRUE A,B,C are defined as given below A:C1 AND(NOT C2) OR C3 B.(NOT C1) OR (NOT C2 AND NOT C3) C.(C1 OR C2)AND C3 D.C1 AND C2 OR C3 given the above information which of the following statements are valid? a.only A,B and C are TRUE b.only A,C and D are TRUE c.A,B,C and D are TRUE d.only C and D are TRUE

1 Answers   TCS,


WHY LRECL NEEDS TO BE 4 EXTRA THEN THE COBOL FILE LENGTH & WHAT IT CONTAIN IN THAT LENGTH

2 Answers   Cap Gemini,


Where the Plan is located in CICS-DB2

2 Answers   IBM,


what is the advantage of sync class

3 Answers   ACS,


I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.

0 Answers   Cap Gemini,






Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?

3 Answers   Microsoft,


we can use set true for condition names.. similarly can we code set to false in cobol pgm? will it work?

1 Answers  


What is the difference between index and subscript?

5 Answers   Visa,


What is the meaning of 'TALLING' verb in cobol?

5 Answers  


Please let me know at which Scenarios we will go for STATIC call or DYNAMIC

3 Answers   IBM,


how we rectify soc7 and soc4 errors in project?

1 Answers   Anaxis, TCS,


What is inspect in cobol ?

0 Answers   Infosys,


Categories