Thursday, December 22, 2011

COBOL : Binary search few tips

1. BINARY SEARCH (i.e. SEARCH ALL) always expects the table to be sorted.

2. If the table is not completely loaded to its max size, be sure to load HIGH-VALUES (if in ascending order) or LOW-VALUES (if descending). These HIGH-VALUES / LOW-VALUES at the end of the table ensure that the table is in SORTED order.

3. If the table is not in sorted order, BINARY SEARCH results are not predictable. 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.