edited by
24,558 views
65 votes
65 votes

Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worst-case time complexity of the best-known algorithm to delete the node $x$ from the list ?

  1. $O(n)$
  2. $O(\log^2 n)$
  3. $O(\log n)$
  4. $O(1)$
edited by

9 Answers

0 votes
0 votes
bcoz of says intermediate node means ; if total n element  , then we go to intermediate through (n/2) ;

and it already says  worst case ; means O(n);

may be this approach is right ;
Answer:

Related questions

51 votes
51 votes
4 answers
1
24 votes
24 votes
1 answer
2
23 votes
23 votes
4 answers
3
Ishrat Jahan asked Nov 2, 2014
4,857 views
Which one of the following binary trees has its inorder and preorder traversals as $BCAD$ and $ABCD$, respectively?
62 votes
62 votes
4 answers
4