What would be the asymptotic time complexity to insert an element at the second position in the linked list?
Anonymous Quiz
36%
O(1)
49%
O(n)
15%
O(n2)
1%
O(n3)
Explanation: A new node is created with the required element. The pointer of the new node points the node to which the head node of the linked list is also pointing. The head node pointer is changed and it points to the new node which we created earlier. The entire process completes in O (1) time. Thus the asymptotic time complexity to insert an element in the second position of the linked list is O (1).
In which events/scenarios, A function name gets optional in JavaScript?
Anonymous Quiz
28%
When a function is defined as a looping statement
16%
When the function is called
38%
When a function is defined as expressions
18%
When the function is predefined
❤2
What will be the output of the following Java code snippet?
Anonymous Quiz
17%
Runtime Error
24%
Compilation Error
32%
It runs successfully
27%
EnumNotDefined Exception
What is the output of below program?
Anonymous Quiz
8%
Print 1
15%
Print 10
40%
Print 20
37%
Compile error
What will be the output of the following C++ program?
Anonymous Quiz
12%
Sanfoundry!
21%
Sanfoundry!.
20%
Sanfoundry.
47%
Sanfoundry.!
❤1
The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?
Anonymous Quiz
27%
Singly linked list
33%
Doubly linked list
23%
Circular doubly linked list
17%
Array implementation of list
👍1
Explanation: We can easily concatenate two lists in O (1) time using singly or doubly linked list, provided that we have a pointer to the last node at least one of the lists. But in case of circular doubly linked lists, we will break the link in both the lists and hook them together. Thus circular doubly linked list concatenates two lists in O (1) time.
Which one of the following code is equivalent to call a function "x" of the class "a" which have two arguments g and h?
Anonymous Quiz
46%
a,x(g,h);
27%
x(g) &&a.x(g);
21%
x(a,g);
5%
(g,h);
What will be the output of the following Java code snippet?
Anonymous Quiz
11%
Runtime Error
26%
EnumNotDefined Exception
33%
It runs successfully
30%
Compilation Error