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 / amit kumar thakur

liner search -data is a linear array with (n)and item is
given this variable algorith find the location (loc)of item
in data. (linear search is used when the address is find)
(Aigorith)
step .1 [insert item at the end of data ]
set data [n+1]:=item
step. 2 set loc:=1
step.3 [search for item]
repeat while data [loc] is not equal to item
set loc :=loc+1
[end of loop]
step.4 if loc =n+1, then
set loc:=0
[end if]
step.5 EXIT.

Binary search
suppose data is an array which is store in increasing
numerical order .then there is a extremly effficient
searching called binary search .
which can be used to find the loc of a given item of
information in data.
e.g.
suppose one want to find the location of some name in a
telephone directory(or some word in a dictionry) then we
use the binary search not the linear search.
ALGORITH OF BINARY SEARCH.
STEP.1 SET BEG= LB, END=UB AND MID= INT.
STEP.2 BEG<=END AND DATA [MID]!ITEM
STEP.3 IF ITEM< DATA[MID], THEN:
set end:=mid-1
step.4 set mid=int[(beg+end)/2]
[end if]
step.5 EXIT.

Is This Answer Correct ?    11 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to debug rfc function module?

1279


What is the logo in sap script?

1048


What are the user groups?

1016


What are internal tables? How do you get the number of lines in an internal table?

1077


What are Table control and tab strip control in dialog programming ?

5795


How can you manipulate the presentation and attributes of interactive lists?

1167


Explain what is the difference between primary key and unique key?

1119


what is difference between (internal table types)standard table and sorted table in sap abap....

2412


What are the function module in bdc?

1252


What is the first thing you do after vendor setup is complete?

1445


The max number of calling modes stacked at one time is?

1109


How to call transaction in session method without recording?

2016


hi i need detailed information on badi and bapi how can this work in real time senarios plz explain with exp

3707


If I forgot some command in sap script e.g.: Suppress zero display – how to do find it?

990


What are the attributes of a field that can be activated or deactivated during runtime?

995