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 |
Can we call a CICS program from a batch program or viceversa?If so, how?
What is the difference between a binary search and a sequential search?
I am getting S00F abend when i try to compare two variable of different pic class,one variable is of 9(09) and another is S9(09) comp-3. First i moved the data from S9(09) comp-3 to 9(09), but no luck. So i tried to move the data from S9(09) comp-3 to X (09) and move to 9(09). I am getting same error message, Please help me to find solution for this ptoblem. ERROR MESSAGE - "The system or user abend S00F R=NULL was issued."
What is amode(24)?
I got user abend U4038 while compiling my runjcl.. can anyone help me?
1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?
I have 100 records in a file.. i want to sort the records from 5 to 5o... give the syntax...
i have a requrement in A as viswa!@#$%&^**reddy i need to move viswareddy in B without junk values pls say how to do ths reply fast
how to remove leading spaces and zeroes in a cobol variable.is there any easy way to do it
COBOL program to read the string ' BOMBAY' in reverse order as 'YABMOB'
comp-3 field occupy?
What are decleratives in COBOL ?