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
Concepts of OO ABAP and why we are using it?
What is direct input method ?
How to debug rfc function module?
There is a situation where there is a field "MATERIAL DESCRIPTION" in say 20 display only transaction. You want that whenever user opens any of these transaction, this particular field is masked with ****. But table does not holds ****. It holds the actual value. What are different ways of doing it? Which is the best way.
What is append search help? : sap abap data dictionary
In which cluster time results are stored? : abap hr
what are the problem we face during development( if we say v are in support(development)? what are the critical problems araises during LSMW updation and Smart form layout development for involce and po? very very important questions now a days commonly asking..plz plz reply me
wat is the difference between A-gate & W-gate?where are they used?
What are Pull and Push Methods?
In the MM module for finding out the standard cost what is the view one has to look at?
In events, start-of-selection is a default event. When we have to use this event explicitly? Why?
What are the Control levels in internal tables?
What is the bitwise operator in the sap abap?
Why do we use events and actions in web dynpro?
What is an abap/4 query? : abap hr