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

Can we use pointers in c++?

815


What is vector string in c++?

819


What's the best free c++ profiler for windows?

842


What is a static element?

809


Define stacks. Provide an example where they are useful.

786


What is fixed in c++?

775


What is buffer and example?

722


Explain public, protected, private in c++?

764


Why is "using namespace std;" considered bad practice?

863


Why struct is used in c++?

826


What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack

830


Is there structure in c++?

787


What is data abstraction? How is it different from data encapsulation?

769


Explain terminate() and unexpected() function?

839


Are vectors faster than arrays?

779