What is the difference between a binary search and a
sequential search?
Answers were Sorted based on User's Feedback
Answer / muhammad abdul aleem
Binary Search | Sequential Search
1.Search All | 1.Search
2.Data should be in sorted | 2.Data can be in any order
order |
3. Only 1 When condition | 3. Any no. of when conditions
can be used | can be used.
4. Only '=' relational | 4. Any relational operator.
operator is used |
5. Access is faster | 5. Access is slow
6.Used for only single | 6. used for single/Multi
dimentional array | dimentional array.
Is This Answer Correct ? | 124 Yes | 19 No |
Answer / guest
Binary search is search all. sequential search is the
linear serach.
Example for Search all: File contains 100 records. supose
if u r searching for 75 th record, first entire file
divided into two parts, it will check , whether record is
in first half or second.. like that file ds divded into
diffrent parts
sequential serach: if the file contains 100 records, spose
if u r looking for 75th record, it will start serach from
first record...
Is This Answer Correct ? | 98 Yes | 12 No |
Answer / shyamendra
Binary search is attampt on file which is in sorted
order.Search All is the key word.Only one 'WHEN'
& 'AND'.Only '=' is used.
While Linear search can be attempt on any
file.Any logical operation is possible.Multiple 'WHEN' are
possible.Index is set to 1 before starting searching.When
table size is small then only we use this.
Is This Answer Correct ? | 40 Yes | 14 No |
Answer / boxee
binary search is fast because
it check the element mid
is element is less
it set the beg
mid=(beg+end)/2;
if(value>a[mid])
{
beg=mid+1;
}
else
{
end=mid-1;
}
Is This Answer Correct ? | 23 Yes | 0 No |
Answer / muthu
binary search runs in O(logn) time whereas linear search
runs in O(n) times thus binary search has better
performance.
Is This Answer Correct ? | 36 Yes | 14 No |
Answer / sahil chawla
HI !!!!
I m Sahil Chawla
It is to be noted that in binary search MID=(start+end)/2
is to be found
but in linear search there is no such condition
Is This Answer Correct ? | 18 Yes | 7 No |
Answer / anupam
binary search is performed by calculating mid point whereas sequential search is performed by sorting all elements.prior is the faster.
Is This Answer Correct ? | 2 Yes | 9 No |
Answer / pratik gondaliya
with binary serch we can not get output faster because it is difficult to sort the character element.
with linear serch we can get output fastest.
example-: hello my name is pratik
Is This Answer Correct ? | 6 Yes | 20 No |
Answer / a.r.rahman(music director
binary and sequensial search is bad.................
Is This Answer Correct ? | 11 Yes | 48 No |
COBOL program to read the string ' BOMBAY' in reverse order as 'YABMOB'
here is my compile and link edit steps in a jcl //COMPILE1 JOB (3CUS,S),'CCDM TEST' //STEPNAME EXEC PGM=IGYCRCTL,PARM='DYNAM,RENT,LIB,OBJECT, // OFFSET,APOST,OPTIMIZE',REGION=4096K //STEPLIB DD DSNAME=PM7351.TEST2.COB,DISP=SHR //SYSIN DD DSNAME=PM7351.TEST2.COB(PGM1),DISP=SHR //SYSUT1 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT2 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT3 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT4 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT5 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT6 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSUT7 DD UNIT=SYSDA,SPACE=(10,(10,10)) //SYSPRINT DD SYSOUT=* //SYSLIN DD DSNAME=&&LOAD,DISP=(MOD,PASS),UNIT=SYSDA, // SPACE=(10,(10,10)),DCB=BLKSIZE=400 //LKED EXEC PGM=IEWL,REGION=1024K //SYSPRINT DD SYSOUT=A //SYSLIB DD DSN=PM7351.TEST2.LOADLIB,DISP=SHR // DD DSN=PM7351.TEST2.COB(PGM1),DISP=SHR //SYSLMOD DD DSN=PM7351.TEST2.LOADLIB, // DISP=SHR //SYSUT1 DD UNIT=SYSDA,DCB=BLKSIZE=1024,SPACE=(CYL,(1,1)) //SYSTERM DD SYSOUT=* //SYSLIN DD DSN=&&LOAD,DISP=(OLD,DELETE) //SYSIN DD DUMMY i am getting IEW2013I 0F08 NO MEMBER NAME WAS SPECIFIED. MODULE WAS SAVED USING TEMPNAM1. could any one tell me the resolution for this..?
) How do u handle errors in BMS macro
Should I use STOP RUN in the sub program??why?
can we read in input the file with a variable length ? please , how ..could you help me ?
i have mainprogram and subgram...if i compile mainprogram without stop run..what will u get in compilation time?
consider the following FD FILE-1 01 REC-1 PIC X(80) ...... WORKING-STORAGE SECTION 01 W-REC PIC X(90) ........ PROCEDURE DIVISION FIRST-PARA ....... READ FILE-1 INTO W-REC AT END MOVE 1 TO EOF-FLAG which of the following is true with respect to the above? a.REC-1 will contain nothing and W-REC will contain the contains of the record read b.REC-1 and W-REC contain the same data c.syntex is invalid and error will occur d.REC-1 and W-REC must be of same size
Can the OCCURS clause be at the 01 level?
what is the meaning of pic 9(09)v99-
Hi , I am posting some questons which are asked at interview. These may help u for ur interview... what is static and dynamic call?
What is the usage of comp fields in cobol?
How will 128 be saved in s9 (3) comp-3 How will 12 be saved in s9 (2) comp