What is the difference between binary search and sequential search in COBOL?
Binary Search | Sequential Search |
---|---|
In this, table element key values should be in an ascending or descending order. | In this, table element keys are not required to be in any order. |
The table is “halved” or divided into two sections to search for the matching result. | The table is searched from the top to bottom in a sequence until the matching result is found. |
The better option for large tables, i.e. tables having more than 70 elements. | The better option for small tables, i.e. tables with less than or equal to 70 elements. |
SEARCH ALL syntax is used in Binary Searches | SEARCH syntax is used for sequential searches. |
BY Best Interview Question ON 06 May 2020