Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

How many lists can a program can produce?

1071


What is singleton pattern in OOPS?

1478


What is the difference between bdc_okcode and bdc_cursor? : abap bdc

1107


What is the full form of spro? : sap abap hr

1334


Can we create an abap program without using y or z?

1090


What is the function of a data element?

1081


What happens if we use leave to list-processing without using suppress-dialog?

1149


in bdc session method. if u run the record in fore ground manually i have a 7 records but at the time of record processing first record produces the error how can u process records manually in fore ground please tell me any one knows?

2156


When a program is created and need to be transported to prodn does selection texts always go with it? If not how do you make sure? Can you change the cts entries? How do you do it?

1050


Can a posting run be deleted? : sap abap hr

1071


What are the 2 other types of views, which are not allowed in release 3.0?

1125


What is a data class? : abap data dictionary

1167


How to find the return code of a statement in abap programs?

1107


What’s value table?

1059


What is meant by authorization? Did you ever work on it? : sap abap hr

947