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


Please Help Members By Posting Answers For Below Questions

How do you get the number of lines in an internal table? How to use a specific number occurs statement?

697


while implementing badi what are the tables u find??

3800


A field containing quantity amounts (data type quan) must be assigned to a reference table and a reference field. Explain? : abap data dictionary

848


What is processing class, where we do them and why? : sap abap hr

813


What is cts and what do you know about it? : abap hr

924


What is the difference between semi-monthly and Bi-weekly payroll area

3223


Explain what is step-loop?

962


What is the collect statement?

876


What is the function of the transport system and workbench organizer?

849


Explain the types of bdc's?

771


What is collective search help? : sap abap data dictionary

800


What is off cycle payroll run

1986


If A is the super class of B. And both the classes have constructor. We create an object of class B. Then which constructor will be called? If both then in which order?

1153


What is the difference between collect and sum?

783


What is an Unpack command?

833