Can we use binary search in internal table sorted in decending
order ? if no why?
Answer Posted / saksham 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 algorithm ,it
will fail for the search.
| Is This Answer Correct ? | 17 Yes | 0 No |
Post New Answer View All Answers
How the Sy-Mandt value gets updated in the table and Is this having any foreign key relationship.
Explain Singleton class
What does the extract statement do in extract datasets? : abap modularization
what is call back in alv?
What is meant by authorization? Did you ever work on it? : sap abap hr
What is the use of at new statement ?
What are internal tables? How to use a specific number occurs statement?
ABAP : Classical reports events name
What is the t-code for transaction recorder? : abap bdc
What is an authorization in sap?
What is a report?
What are the different methods of bdc? : abap bdc
What is the advantage of structures?
Does the external program run in the same sap luw as the caller, or in a separate one?
What are the different types of abap reports in sap?