what is the difference b/w linear search and binary search?
(how can these search)

Answer Posted / jayati saha

Linear search is ver easy and always search in sequential
way.
It starts searching from the first element upto the last
element until the search finds the number .

Let us take an example.
Let there are a list of numbers.
1,3,8,6,5,8,2,9
We have to search if 5 is there in the list or not.
So, we start from the first element from 1.
then we see 3,8,6 and then find 5.
As soon as we find the search element 5 in the list we stop
searching,otherwise we continue the search upto the last
element.
Binary search

In binary search we always start from the middle elment and
compare the middle element to the search element.
If the search element is less than the middle element then
we go to the less half otherwise we go to the larger half.
In binary search the nos should be sorted in ascending
order at first.
Let us took an example of binary search.
Assume that we are reading a book.
The book has a huge volume.
let we have to find the page no 120 in this book.
The book has 200 pages approx.
Then we do not start looking for the page from the first
page, rather we look at the middle.
If the arbitrary page is 101 then we think that 120 paghe
is more than the 101 page so we go to the half which
contains more pages. So by using this method again and
again we can finally find out the page .

Is This Answer Correct ?    86 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

1.why dont use top of page. wat is the use? 2. wat is sub screen? 3. why u select the session method in bdc ? how many records wil be updated on that time? 4.why dont use start form in script? 5.wat is difference b/w dilldown and interactive report? 6. wat is pf status interactine report?

2352


Explain what are the problems in processing batch input sessions? How is batch input process different from processing on line?

581


What is the project you are currently working and work that you are doing

1016


What are the differences between a database index and a match code? : abap data dictionary

647


What are the data types of the external layer?

579






How do you import pay scale data from non sap to sap? : sap abap hr

576


What are the attributes of the data? : abap data dictionary

650


IN SCRIPTS IF WE HAVE EMPTY SECOND LAYOUT AND IF WE HAVE MENTIONED ABOUT IT IN NEXT PAGE ATTRIBUTE THEN IN OUTPUT HOW WE GET THE SECOND PAGE OUTPUT.

1499


What are the differences between primary and secondary indexes?

612


If I want to execute a program only in background not in foreground is there any option for this? : abap bdc

560


What are spa/gpa parameters (sap memory)?

717


What are the disadvantages of abap query tool?

587


If A is the super class of B. And both the classes have constructor. We create an object of class B. Then which constructor will be called? If both then in which order?

927


What is table attribute? : abap data dictionary

569


Different types of locks?

629