The best-case time complexity for this function would be _________, where n is the number of elements.

```
1 bool search( Node ptr, Bird & bird, Bird dove )
2 {
3 if ( ptr == NULL )
4 return false;
5 if ( ptr->info == dove ) {
6 bird = ptr->info;
7 return true;
8 }
9 return search( ptr->next, bird, dove );
10 }
```
which is called for a linked list (where start points to the first node) using the lines of code:
```
if ( search( start, bird, dove ) )
cout << “search successful” << endl;
```
A. O( lg n )
B. O( 1 )
C. O( n2 )
D. O( n )


1

Computer Science & Information Technology

You might also like to view...

When you export a presentation to a Word outline, slide titles are formatted with the Heading 1 style and bulleted text is formatted with the Heading 2 style

Indicate whether the statement is true or false

Computer Science & Information Technology

When creating headers and footers, you can type your own text or insert header and footer ________ such as pictures, page numbers, and the date and time

Fill in the blank(s) with correct word

Computer Science & Information Technology

What value is returned by thetimefunction?

A. seconds elapsed since midnight, 1/1/1970 B. minutes elapsed since midnight, 1/1/1970 C. hours elapsed since midnight, 1/1/1970 D. days elapsed since midnight, 1/1/1970

Computer Science & Information Technology

A technician needs to limit the amount of broadcast traffic on a network and allow different segments to communicate with each other. Which of the following options would satisfy these requirements?

A. Add a router and enable OSPF. B. Add a layer 3 switch and create a VLAN. C. Add a bridge between two switches. D. Add a firewall and implement proper ACL.

Computer Science & Information Technology