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 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
Get step-by-step solutions from verified subject matter experts
