Professional Documents
Culture Documents
Algo Week 10
Algo Week 10
1.In a doubly linked list, the time complexity to search and delete the last node from head is O(1).
True
False
2.In a circular singly linked list, the time complexity to search and delete the last node from head is O(n).
True
False
3.In a circular doubly linked list, the time complexity to search and delete the last node from head is
O(n).
True
False
4.In a circular singly linked list where only the first node is being referenced by a pointer/object, the
time complexity to insert a new node at the end of the list is O(n).
True
False
5.In a doubly linked list where only the first node is being referenced by a pointer/object, the time
complexity to insert a new node at the end of the list is O(n).
True
False
6.In a singly linked list where only the first node is being referenced by a pointer/object, the time
complexity to insert a new node at the end of the list is O(n).
(1 Point)
True
False
7.The time complexity of searching a value in a skip list with 2 layers is O(√n).
True
False
8.In a singly linked list, the time complexity to delete the first node is O(1).
True
False
9.The worst-case search time for a sorted linked list is O(2n).
True
False
10.In a circular doubly linked list where only the first node is being referenced by a pointer/object, the
time complexity to insert a new node at the end of the list is O(n).
True
False
Post test
1 Display the value of data property of the fourth node in the upper list.
System.out.print(mid.getNext().getData());
System.out.print(mid.getBottom().getData());
System.out.print(mid.getBottom().getNext();
System.out.print(mid.getBottom().getNext().getData());
2 In a singly linked list, the time complexity to delete the first node is O(1).
True
False
3 In a circular singly linked list where only the first node is being referenced by a pointer/object, the time
complexity to insert a new node at the end of the list is O(n).
True
False
4 In a circular doubly linked list where only the first node is being referenced by a pointer/object, the
time complexity to insert a new node at the end of the list is O(n).
True
False
5 Set the data property of the eighth node in the lower list to 7.
mid.getBottom().getBottom().setData(7);
mid.getBottom().getBottom().getData(7);
mid.getBottom().getNext().setData(7);
mid.getBottom().getNext().getData(7);
6 In a doubly linked list, the time complexity to search and delete the last node from head is O(1).
True
False
7 In a circular singly linked list, the time complexity to search and delete the last node from head is O(n).
True
False
8 The worst case search time for a sorted linked list is O(2n).
True
False
9 The time complexity of searching a value in a skip list with 2 layers is O(√n).
True
False
10 In a circular doubly linked list, the time complexity to search and delete the last node from head is
O(n).
True
False
11 In a singly linked list where only the first node is being referenced by a pointer/object, the time
complexity to insert a new node at the end of the list is O(n).
True
False
12 Compute the difference between the second and fourth node’s data properties in the upper list.
13 Compute the sum of the second and eighth node’s data properties in the lower list. Store the result
to sum (an integer variable).
14 In a doubly linked list where only the first node is being referenced by a pointer/object, the time
complexity to insert a new node at the end of the list is O(n).
True
False
15 Compute the sum of the third and fourth node’s data properties in the upper list. Store the result to
sum (an integer variable).