what is a binary search ? and how it is useful in a sorted
internal table ?
Answer / shweta upadhyay
Definition: Search a sorted array by repeatedly dividing
the search interval in half. Begin with an interval
covering the whole array. If the value of the search key is
less than the item in the middle of the interval, narrow
the interval to the lower half. Otherwise narrow it to the
upper half. Repeatedly check until the value is found or
the interval is empty.
SYNTAX : READ TABLE <itab> WITH KEY <k1> = <f1>... <kn> =
<fn> <result>
BINARY SEARCH.
CODE :
REPORT demo_int_tables_read_index_bin.
DATA: BEGIN OF line,
col1 TYPE i,
col2 TYPE i,
END OF line.
DATA itab LIKE STANDARD TABLE OF line.
DO 4 TIMES.
line-col1 = sy-index.
line-col2 = sy-index ** 2.
APPEND line TO itab.
ENDDO.
SORT itab BY col2.
READ TABLE itab WITH KEY col2 = 16 INTO line BINARY SEARCH.
WRITE: 'SY-SUBRC =', sy-subrc.
The output is:
SY-SUBRC = 0
The program fills a standard table with a list of square
numbers and sorts them into ascending order by field COL2.
The READ statement uses a binary search to look for and
find the line in the table where COL2 has the value 16.
Is This Answer Correct ? | 1 Yes | 0 No |
visibility section for class level and attributes level
Is a logical database a requirement/must to write an abap/4 query?
How to Modify the standard invoice and sales order form to generate purchase order for printing and upload the company logo. plz mention the detail coding Tahnks, Rahul
What is a size category?
what is meant by leave -list processing?
How do you send the output of a script as an email attachment
How many sessions will be opened using bdc_open_group?
Suppose there is check box along with the rows. The requirement is, select the require check boxes and press a used defined button to save all these checked row data to another table. How can you do it?
I have 2 inputs in Module pool prgm, if i click on the input i need to get drop down list..How to get it..
Hi all, For the past 1 year, I have been trying for job in SAP as a fresher, but no calls,no interviews.I know showing fake experience is unethical, but i dont have any alternative.After showing fake experience now iam getting calls,but still i feel guilty.Friends i have some questions. 1. If suppose i tell the truth in interview that i have shown fake experience,what would be the interviewer's reaction? Will accepting the fake go negative against me? 2.Whether i should accept the fake in technical round itself? (or) Maintain the fake,prove myself strong in technical round &then accept the fake in HR round? 3.Some of my friends(who have shown fake and well settled in MNC's ) are telling that during interview u should never accept as fake i.e., u should act confidently as a real experienced guy.Even if the interviewer come to know that u r a fake guy, but seeing ur confidence level ,he/she will select u ? Is it true? Friends, particularly interviewer's , HR's please give me ur valuabe solutions.Other's suggestions are also welcome.
What is the difference between At first and On change control command.
What is asynchronous and synchronous update?