retagged by
9,700 views
19 votes
19 votes

Consider the problem of reversing a singly linked list. To take an example, given the linked list below,

the reversed linked list should look like

Which one of the following statements is $\text{TRUE}$ about the time complexity of algorithms that solve the above problem in $O(1)$ space?

  1. The best algorithm for the problem takes $\theta(n)$ time in the worst case.
  2. The best algorithm for the problem takes $\theta(n \log n)$ time in the worst case.
  3. The best algorithm for the problem takes $\theta(n^{2})$ time in the worst case.
  4. It is not possible to reverse a singly linked list in $O(1)$ space.
retagged by

5 Answers

Answer:

Related questions

15.8k
views
3 answers
41 votes
Arjun asked Feb 15, 2022
15,837 views
Suppose a binary search tree with $1000$ distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assumin...
19.3k
views
6 answers
34 votes
Arjun asked Feb 15, 2022
19,260 views
Consider the queues $Q_{1}$ containing four elements and $Q_{2}$ containing none (shown as the $\textsf{Initial State}$ in the figure). The only operations allowed on the...
651
views
1 answers
2 votes
admin asked Sep 1, 2022
651 views
There is an unsorted list of $n$ integers. You are given $3$ distinct integers and you have to check if all $3$ integers are present in the list or not. The only operatio...
5.9k
views
3 answers
8 votes
Arjun asked Feb 15, 2022
5,943 views
A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From the additiona...