Can we remove an element in a single linked list without
traversing?
Lets suppose the link list is like this
1 2 3 4 5 6

We need to remove 4 from this list (without traversing from
beginning) and the final link list shud be 1 2 3 5 6

only thing we know is the pointer to element "4". How can
we remove "4" and link "3" to "5"?

Answer Posted / truong nguyen

Memory address of all elements in a linked list are not
continuous. So if we only know the memory address of the
element "4", we cannot know memory address of element "3"
and "5" without traversing. And we cannot remove it from the
linked list.

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are separators in c++?

620


Array base access faster or pointer base access is faster?

1809


Is c++ the hardest programming language?

634


What are the uses of typedef in a program?

608


What do you mean by translation unit in c++?

664






Which is better c++ or java?

558


Can we define a constructor as virtual in c++?

601


Why c++ is not a pure oop language?

551


What are structures and unions?

565


Explain the scope of resolution operator.

623


Difference between declaration and definition of a variable.

583


What is private public protected in c++?

547


What is c++ good for?

581


Explain how to initialize a const member data.

593


What is a buffer c++?

579