what is a binary search ? and how it is useful in a sorted
internal table?

Answer Posted / saplead.sai

The solution provided by Siddhart is though correct, I
would like to project the solution in a much detailed with
example.
Binary Search Basic rule - Sort the data in Ascending order.
Suppose we have random numbers ranging from 1 to 10000 and
we are searching for 4219. If the data is unorganized and
random....a sequential search would be time consuming.
Hence once the data is sorted in Ascending order. Binary
search would reduce the LOOKUP time.
In the FIRST PASS BINARY search would split the range of 1 -
10000 in to two halfs (i.e 1 - 4999 & 5000 - 10000) and
compares the 4219 which happens to fall in the first half.
In the next pass again two halfs are made and compared.
This way BINARY SEARCH works by dividing either data into
two halfs.
For internal table......or for anything else....this is it

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of table control in bdc is it same in module pool table control? : abap bdc

676


What will be your approach towards optimizing legacy code? Will you suggest change in technology? Does OO ABAP bring any performance benefits? How will you deal with queries in a loop? How will you optimize nested loops?

906


What is sapnet?

887


What is the step-by-step process to create a table in data dictionary? : abap data dictionary

697


What is a size category?

679






Describe data classes? : abap hr

630


Differentiate screen painter from menu painter.

564


How do you execute the payroll

1832


What is the structure of bdcmsgcoll? : abap bdc

784


What is the different between abap and ooabap? Why do we use ooabap?

636


What are the components of sapscript?

627


While sorting field groups we cannot use more than one key field. State true or false. : abap modularization

591


Can a transparent table exist in data dictionary but not in the data base physically? : sap abap data dictionary

617


Reports: Event functionality.

890


Difference between BDC vs Direct Loads?

662