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
What is logical database? : abap hr
What is append structure?
Mention what is alv programming in abap?
Explain the disadvantage of using exec sql statement in abap?
List the various components of the enterprise structure in systems, applications, and products (sap) in human capital management (him)? : sap abap hr
What is the lock object?
How do you find out whether a file exits on the presentation server?
What is the max no of match code id's that can be defined for one match code object? : abap data dictionary
What is the reserve command?
What is the difference between select statement and provide statement ? : abap hr
SM35 transaction, How to automate BDC ?
What is the difference between skip and reserve?
Explain the disadvantages of different types of bdc's?
Different types of locks?
how do you call third selection screen ?