what is meant by binary search?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Whtz the specialty of 77 level number ?
How to read records which is in sequential file in reverse order ? Exp. 1 2 3 4 5 . i want 5 4 3 2 1?please clear my doubt any one
A cobol program to read a file , match it with other if. If match occurs then write it to an output file. If no match then no need to write it.Error log created by program to track any error.
I have sequential file recl 1000 i want to add another 15 bytes to it. The record length should not change..How?
I have a occurs for 100 times but it has executed 101 time what could be the reason?
What will happen if we try to create GDG (+2) generaton instead of (+1) generation?
What is inspect in cobol ?
What is the difference between comp and comp-3 usage? Explain other COBOL usage?s.
There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.
why mainframe we use not like java as frontend oracle as backend. or not word excel.In there also huge ammount data stored.
given the following piece of code: CALL SUB-PGM USING A, B, C. CALL SUB-PGM USING A, C, C. (a) Both CALL statements will always produce same result. (d) Both CALL statements may produce different result. (c) Compile-time error because SUB-PGM is a dataname. (d) Compile-time error because A, B, C are used twice.
Sending data is aplhabetic size 7 (value 3000), I wantated this value to be stored in database, which is defined as s9(7)v9(2)comp-3.