Can we use binary search in internal table sorted in decending
order ? if no why?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
Answer / arpit gupta
Algorithm wise Binary Search works with sorted data both ascending or descending , but in ABAP to perform binary Search Data Must be sort in ASCENDING order, So the answer to the question is NO
Is This Answer Correct ? | 5 Yes | 0 No |
Explain what are extracts?
What is a transaction variant and why are they used?
2)what is the differnce between user exits and Badi
What is the diffrence between Abstract Class and an Interface in OOABAP.
for uploading master data(ex:customer data) into sap, which methods you prefer? call transaction/session/lsmw/bapi? why?
what is use of material master c segment(marc) table?
What is Smart Forms?
What is difference between BDC and Call Transaction?
what is the difference table type and structure?
8 Answers IBM, Reliance, Tech Mahindra,
How can we upload a text file having delimiters in to legacy system? : abap bdc
How to Create an Interactive List based on the selection criteria specified for the customer number for displaying the customer information on the basic list, their corresponding order details on the secondary list. Plz specify the coding details. Regards, Rahul
Explain different types of attributes of function module?