Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the difference between a binary search and a sequential search? What are the pertinent COBOL commands?

0
Posted

What is the difference between a binary search and a sequential search? What are the pertinent COBOL commands?

0

Ans: In a binary search the table element key values must be in ascending or descending sequence. The table is ‘halved’ to search for equal to, greater than or less than conditions until the element is found. In a sequential search the table is searched from top to bottom, so (ironically) the elements do not have to be in a specific sequence. The binary search is much faster for larger tables, While sequential Search works well with smaller ones. SEARCH ALL is used for binary searches; SEARCH for sequential. 2. How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning. Ans: Syntax: SORT file-1 ON ASCENDING/DESCENDING KEY key. USING file-2 GIVING file-3. USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2 GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2. file-1 is the sort workfile and must be described using SD entry in FILE SECTION. file-2 is the input file for the SORT and must be described using an FD entry in F

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123