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

Answers were Sorted based on User's Feedback



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

Answer / vandan

in case of linear search system will search from begining.
that means Example : z table contains single field with values
1 2 3 4 5 6 7 8 9
if u r searching for a value then system will starts from
first position. if required value is founded then execution
will comes out from z table.

in case of binary search system will starts from mid point.
if value is not founded then it will search for upper half.
in that upper half it will check mid point.like that search
will takes place.

Is This Answer Correct ?    112 Yes 26 No

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

Answer / 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

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

Answer / asit kumsr tripathy

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 lower half otherwise we go to the upper 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 ?    31 Yes 2 No

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

Answer / kaloo

binary search is complex whle the linear search is more easy

Is This Answer Correct ?    58 Yes 32 No

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

Answer / prabhjot singh

1.linear search is easy bt takes more time to search an
element as it compare all element sequentially...
2.elements r arranged randomly.

1. in binary search it start searching from middle, if the
searching element is not found in middle then it goes to
1/4,and vice versa..
and hence take less time than linear search.
2.elements r arranged in sorted orrder.

Is This Answer Correct ?    32 Yes 9 No

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

Answer / greeshma and arya

time complexity of linear search is O[n] whereas that of binary search is O[logn].therefore binary search is faster than linear search.

Is This Answer Correct ?    23 Yes 4 No

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

Answer / indrani chowdhury

1.linear search is easy bt takes more time to search an
element as it compare all element sequentially...
2.elements r arranged randomly.

1. in binary search it start searching from middle, if the
searching element is not found in middle then it goes to
1/4,and vice versa..
and hence take less time than linear search.
2.elements r arranged in sorted orrder.

Is This Answer Correct ?    17 Yes 3 No

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

Answer / jeyachandran.p

Binary search is an efficient search compared to linear
search.Binary search requires sorted array while linear
search operates on unsorted array.

In binary search ,we looks through half of the list i.e
the element to be search is compared with mid value, if it
equals to mid value,search operation is over.otherwise if
the search element is smaller we have to search in the first
half of the list else we have to look in second half of the
list.

But linear search or sequential search requires an complete
search over the list.As far as ,Binary search is very best
in time and efficiency.It requires O[log n} times but linear
search requires O[n]times.

Is This Answer Correct ?    14 Yes 3 No

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

Answer / anupama singh

| Binary search | Linear search |
-------------------------------------------------------------------------------------------------------------------------
1).Data must be in a sorted order | 1).Data any order
2).Time complexity is O(log n) | 2).Time complexity is O(n).
3).Only 1 "When" condition used | 3).Any no. of "When" condition used
4).Only "=" relation operator is used | 4).any relation operator is used
5).Access is faster | 5).Access is slow
6).Only single dimensional array used | 6).single/multi dimensional array used

Is This Answer Correct ?    8 Yes 1 No

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

Answer / 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

More SAP ABAP Interview Questions

how many index created for table

10 Answers   Wipro,


What is an abap data dictionary? : abap data dictionary

0 Answers  


Explain about drill down report?

0 Answers  


Difference bet'n simple and interactive reports?

1 Answers  


what is the main difference between headerline and workarea??

3 Answers  






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

0 Answers  


suppose you are using session method for 1000 records and there is error in 400 and 500 records.how many records will be updated to the database?

3 Answers  


what is direct input method?

1 Answers   Keane India Ltd,


What are the requirements a dialog program must fulfill?

0 Answers  


Events in Interactive reporting?

3 Answers   TCS,


what is result set of an inner join at database level ?

1 Answers  


How do you call a transaction from a report ?

3 Answers  


Categories
  • SAP Basis Interview Questions SAP Basis (1262)
  • SAP ABAP Interview Questions SAP ABAP (3939)
  • SAPScript Interview Questions SAPScript (236)
  • SAP SD (Sales & Distribution) Interview Questions SAP SD (Sales & Distribution) (2716)
  • SAP MM (Material Management) Interview Questions SAP MM (Material Management) (911)
  • SAP QM (Quality Management) Interview Questions SAP QM (Quality Management) (99)
  • SAP PP (Production Planning) Interview Questions SAP PP (Production Planning) (523)
  • SAP PM (Plant Maintenance) Interview Questions SAP PM (Plant Maintenance) (252)
  • SAP PS (Project Systems) Interview Questions SAP PS (Project Systems) (138)
  • SAP FI-CO (Financial Accounting & Controlling) Interview Questions SAP FI-CO (Financial Accounting & Controlling) (2766)
  • SAP HR (Human Resource Management) Interview Questions SAP HR (Human Resource Management) (1180)
  • SAP CRM (Customer Relationship Management) Interview Questions SAP CRM (Customer Relationship Management) (432)
  • SAP SRM (Supplier Relationship Management) Interview Questions SAP SRM (Supplier Relationship Management) (132)
  • SAP APO (Advanced Planner Optimizer) Interview Questions SAP APO (Advanced Planner Optimizer) (92)
  • SAP BW (Business Warehouse) Interview Questions SAP BW (Business Warehouse) (896)
  • SAP Business Workflow Interview Questions SAP Business Workflow (72)
  • SAP Security Interview Questions SAP Security (597)
  • SAP Interfaces Interview Questions SAP Interfaces (74)
  • SAP Netweaver Interview Questions SAP Netweaver (282)
  • SAP ALE IDocs Interview Questions SAP ALE IDocs (163)
  • SAP Business One Interview Questions SAP Business One (110)
  • SAP BO BOBJ (Business Objects) Interview Questions SAP BO BOBJ (Business Objects) (388)
  • SAP CPS (Central Process Scheduling) Interview Questions SAP CPS (Central Process Scheduling) (14)
  • SAP GTS (Global Trade Services) Interview Questions SAP GTS (Global Trade Services) (21)
  • SAP Hybris Interview Questions SAP Hybris (132)
  • SAP HANA Interview Questions SAP HANA (700)
  • SAP PI (Process Integration) Interview Questions SAP PI (Process Integration) (113)
  • SAP PO (Process Orchestration) Interview Questions SAP PO (Process Orchestration) (25)
  • SAP BI (Business Intelligence) Interview Questions SAP BI (Business Intelligence) (174)
  • SAP BPC (Business Planning and Consolidation) Interview Questions SAP BPC (Business Planning and Consolidation) (38)
  • SAP BODS (Business Objects Data Services) Interview Questions SAP BODS (Business Objects Data Services) (49)
  • SAP BODI (Business Objects Data Integrator) Interview Questions SAP BODI (Business Objects Data Integrator) (26)
  • SAP Ariba Interview Questions SAP Ariba (9)
  • SAP Fiori Interview Questions SAP Fiori (45)
  • SAP EWM (Extended Warehouse Management) Interview Questions SAP EWM (Extended Warehouse Management) (58)
  • Sap R/3 Interview Questions Sap R/3 (150)
  • SAP FSCM Financial Supply Chain Management Interview Questions SAP FSCM Financial Supply Chain Management (101)
  • SAP WM (Warehouse Management) Interview Questions SAP WM (Warehouse Management) (31)
  • SAP GRC (Governance Risk and Compliance) Interview Questions SAP GRC (Governance Risk and Compliance) (64)
  • SAP MDM (Master Data Management) Interview Questions SAP MDM (Master Data Management) (0)
  • SAP MRS (Multi Resource Scheduling) Interview Questions SAP MRS (Multi Resource Scheduling) (0)
  • SAP ESS MSS (Employee Manager Self Service) Interview Questions SAP ESS MSS (Employee Manager Self Service) (13)
  • SAP CS (Customer Service) Interview Questions SAP CS (Customer Service) (0)
  • SAP TRM (Treasury and Risk Management) Interview Questions SAP TRM (Treasury and Risk Management) (0)
  • SAP Web Dynpro ABAP Interview Questions SAP Web Dynpro ABAP (198)
  • SAP IBP (Integrated Business Planning) Interview Questions SAP IBP (Integrated Business Planning) (0)
  • SAP OO-ABAP (Object Oriented ABAP) Interview Questions SAP OO-ABAP (Object Oriented ABAP) (70)
  • SAP S/4 HANA Finance (Simple Finance) Interview Questions SAP S/4 HANA Finance (Simple Finance) (143)
  • SAP FS-CD (Collections and Disbursements) Interview Questions SAP FS-CD (Collections and Disbursements) (0)
  • SAP PLM (Product Lifecycle Management) Interview Questions SAP PLM (Product Lifecycle Management) (0)
  • SAP SuccessFactors Interview Questions SAP SuccessFactors (33)
  • SAP Vistex Interview Questions SAP Vistex (0)
  • SAP ISR (IS Retail) Interview Questions SAP ISR (IS Retail) (28)
  • SAP IdM (Identity Management) Interview Questions SAP IdM (Identity Management) (0)
  • SAP IM (Investment Management) Interview Questions SAP IM (Investment Management) (0)
  • SAP UI5 Interview Questions SAP UI5 (59)
  • SAP SCM (Supply Chain Management) Interview Questions SAP SCM (Supply Chain Management) (51)
  • SAP XI (Exchange Infrastructure) Interview Questions SAP XI (Exchange Infrastructure) (49)
  • SAP Cloud Platform Interview Questions SAP Cloud Platform (34)
  • SAP Testing Interview Questions SAP Testing (89)
  • SAP SolMan (Solution Manager) Interview Questions SAP SolMan (Solution Manager) (63)
  • SAP MaxDB Interview Questions SAP MaxDB (116)
  • SAP GUI Interview Questions SAP GUI (15)
  • SAP AllOther Interview Questions SAP AllOther (329)