MCQOPTIONS
Bookmark
Saved Bookmarks
→
BHEL
→
Aptitude & Logical - BHEL
→
What is the time complexity of the above recursive...
1.
What is the time complexity of the above recursive implementation of linear search?
A.
O(1)
B.
O(n)
C.
O(n2)
D.
O(n3)
Answer» C. O(n2)
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
What is the time complexity of the above recursive implementation of linear search?
Consider the following recursive implementation of linear search on a linked list: struct Node { int val; struct Node* next; }*head; int linear_search(struct Node *temp,int value) { if(temp == 0) return 0; if(temp->val == value) return 1; return _________; } Which of the following lines should be inserted to complete the above code?
What will be time complexity when binary search is applied on a linked list?
Can binary search be applied on a sorted linked list in O(Logn) time?
Consider the following code snippet to search an element in a linked list: struct Node { int val; struct Node* next; }*head; int linear_search(int value) { struct Node *temp = head->next; while(temp != 0) { if(temp->val == value) return 1; _________; } return 0; } Which of the following lines should be inserted to complete the above code?
Which of the following methods can be used to search an element in a linked list?
Identify the disadvantages of bit array.
What will be the output of the following C code? #include <stdio.h> int main() { int x = 3, y = 2; int z = x << 1 > 5; printf("%d\n", z); }
What will be the output of the following C code? #include <stdio.h> int main() { int x = 3, y = 2; int z = x /= y %= 2; printf("%d\n", z); }
What will be the output of the following C code? #include <stdio.h> int main() { int x = 1, y = 2; int z = x & y == 2; printf("%d\n", z); }
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies