Hash Tables

1. Which of the following is an advantage of using arrays over linked lists?
  1) Accessing elements at specific positions is faster.
2) The size of the array is fixed.
3) For the same number of elements, array uses less memory as compared to linked list.
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

2. What will be the output of the following function ?(head is the first node of a linked list)
void traverse(struct node* head)
{
printf("%d ", head->data);
head = head ->next;
traverse(head)
}
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

3. What is the time complexity of inserting an element in start and end of a singly linked list respectively?(N = number of elements currently in Linked List)
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

4. In which of the following implementations Linked lists can be used ?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

5.
def f(n):
If n == 0 or n == 1: return 1
return f(n-1) + f(n-2)

Time complexity of this program:
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation