Question: What does the following function do for a given linked list (not empty) with first node as head? void fun1(struct node* head){ if(head == NULL){

  1. What does the following function do for a given linked list (not empty) with first node as head?

void fun1(struct node* head){ if(head == NULL){ return;}

fun1(head->next);

cout << head->data <

  1. Print all nodes of linked list
  2. Print all nodes of linked list in reverse order
  3. Print alternate nodes of linked list
  4. Print alternate nodes in reverse order

  1. Which of the following is false?
    1. The time complexity for one division is constant.
    2. The time complexity for Travelling Salesmen Problem is O(2n).
    3. The time complexity for one double write is constant.
    4. The time complexity for one integer read is constant.

  1. Which of the following Big O is most desired when designing an algorithm?
    1. O(n2)
    2. O(logn)
    3. O()
    4. O(n logn)

  1. When calculating the Big-O for an algorithm, which of the following rules is not true?
    1. Focus on the dominant
    2. Disregard any constants
    3. Focus only on polynomials
    4. None of the above

  1. Which of the following scenario has the worst O(n)?
    1. Swap two integers with the help of using a temporary variable
    2. Search a non-existence value is a degenerate binary tree with n nodes
    3. Create a new node to a BST with n nodes
    4. Execute a loop with 10000 iterations

  1. Which of the following statement is true?
    1. When using iteration and recursion to implement factorial, Big O is the same
    2. When using iteration and recursion to find Fibonacci sequence, Big O is the same
    3. When using iteration and recursion to print Pascals Triangle, Big O is the same D. None of the above

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!