The following is the pseudocode for which type of algorithm?

```
Set first to 0
Set last to the last subscript in the array
Set found to false
Set position to -1
While found is not true and first is less than or equal to last
Set middle to the subscript halfway between array[first] and array[last]
If array[middle] equals the desired value
Set found to true
Set position to middle
Else If array[middle] is greater than the desired value
Set last to middle - 1
Else
Set first to middle + 1
End If
End While
Return position
```

a. linear sort
b. linear search
c. binary search
d. selection sort
e. None of these


c. binary search

Computer Science & Information Technology

You might also like to view...

What is wrong with the following switch statement?

int ans; cout <<"Type y for yes on n for no\n"; cin >> ans; switch (ans) { case 'y': case 'Y': cout << "You said yes\n"; break; case 'n': case 'N': cout << "You said no\n"; break; default: cout <<"invalid answer\n"; } a. ans is a int b. break; is illegal syntax c. nothing d. there are no break statements on 2 cases.

Computer Science & Information Technology

Will the following program terminate?

``` int balance = 10; while (true) { if (balance < 9) continue; balance = balance - 9; } ``` a. Yes b. No

Computer Science & Information Technology

A(n) ____________________ symbol is one that contains instances of other symbols within its Timeline.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Specially trained system and network administrators are often a CSP's first responders.?

Answer the following statement true (T) or false (F)

Computer Science & Information Technology