- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sorting an already sorted internal table in ABAP
If you leave 2nd sort, it would be quicker as itab will be there in right order.
SORT itab by f1 f2 f3. READ TABLE itab WITH KEY f1 = 'A' f2 = 'B' f3 = 'C' BINARY SEARCH. READ TABLE itab WITH KEY f1 = 'A' BINARY SEARCH.
When 2nd READ TABLE is by f2, you should leave the SORT and BINARY SEARCH as well. In best case scenario, SORT + BINARY SEARCH speed is n+log(n).
Also note that worst case of sort is n log n.
Advertisements
To Continue Learning Please Login
Login with Google