Can we use binary search in internal table sorted in decending
order ? if no why?

Answer Posted / sunil kumar gautam

Binary search algorithm is based on middle value , first
data is divided into two part on the basis of middle value
so that left side data is less than middle value and right
side data greater than middle value. Search value is equal
to middle value then it give result middle value. If search
value is greater than middle value it will be search right
side of middle value ,if search value is less than middle
value it will search left side. So Data should be ascending
order so that greater value will be right side of middle
value and lesser value will be left side of middle value.
For example 1,2,3,4,5,6,7,8,9 here middle value is 5.Now we
search 7 it will be search in right part from 5.It is give
result. It’s opposite if it is in descending order
9,8,7,6,5,4,3,2,1.Here 5 is middle value and 7 is searched
in right from 5 according to binary search principle ,it
will fail for the search.

Is This Answer Correct ?    36 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to create user interfaces for lists?

612


A field containing currency amounts (data type curr) must be assigned to a reference table and a reference field. Explain?

864


What are the events driven batch jobs?

587


List the events in abap/4 language?

586


How can we upload a text file having delimiters in to legacy system? : abap bdc

612






What is the function of a domain?

639


What is direct input method ?

1466


Badi concepts

919


What is transparent table?

597


Can a domain, assigned to a data element be changed?

627


what is leave to TRANSACTION?

1000


Select up to 1 row and select single difference ?

648


1. If I send 5 entries of table from one system to another system, if the only 4 entries there in the target system what I have to do? 2. If I send the customer master IDOC from one SAP system to another system, if one field is missing in target table what is the steps? 3. If I want to access the 4th row 3rd column in the hashed table how to do it? 4. Whether there is any other statement than MODIFY statement to modify the content of internal table?

1412


what is 3 tire architecture and how does SAP utilizes this architecture. and how do netweaver came into picture?

1728


What are the client dependant objects in abap / sap?

532