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
hi i need detailed information on badi and bapi how can this work in real time senarios plz explain with exp
What is the difference between getting and get late?
What are the page windows?
What will happen when we use fully buffered in abap?
What are the types of records that are transferred to sap r/3 and used by interfaces? : abap bdc
ALV Report that will show the details of order like order no, order date, customer, product code & description, order quantity and value along with the details of dispatch of those orders like invoice no, invoice date, invoice quantity and pending order quantity. plz mention the detail coding Tahnks, Rahul
What happens if a function module runs in an update task? : abap modularization
what is user specific parameter?
How to get that a secondary index is attached to a select query?
what are the various types of parameters and how are they distinguished from one another?
What is an abap?
What is asynchronous update?
What is For-period and In-period
Explain the advantages and disadvantages of different types of bdc's?
Explain the sequences of event block?