Question: struct Node int data struct Node *next; The following code is for finding a key in a linked list passed as head What is the

 struct Node int data struct Node *next; The following code is

struct Node int data struct Node *next; The following code is for finding a key in a linked list passed as head What is the best case and worst case complexity of the function? The linked list has n nodes. bool findKey (Node* head, int key) Node* temphead; while(temp) if(temp->data key ) return true; temptemp->next; return false; Select one: a. Best ( log n ) and Worst: O( n log n) b. Best: 21) and Worst: O( n2) c. Best: 2( n) and Worst:o( n2) d. Best:Q( 1) and Worst: O( n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!