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...

Unbuffered SDRAM is faster than buffered SDRAM

Indicate whether the statement is true or false

Computer Science & Information Technology

The term "database" has evolved from a specialized technical term into part of our everyday vocabulary. Please define database, database software, record, field, and relational database.

What will be an ideal response?

Computer Science & Information Technology