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 / mpoleg

1) copy content of element 5 to element 4
2) link element 4(which already contains number 5) to
element 6
3) delete element 5

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know what are static and dynamic type checking?

614


how to connect with oracle 9i with server in socket program in c/c++

1847


Can member functions be private?

591


How is c++ used in the real world?

569


Is it possible to use a new for the reallocation of pointers ?

594






Can we inherit constructor in c++?

583


What are c++ templates used for?

614


Which is the best c++ compiler for beginners?

555


What is a stack? How it can be implemented?

694


What is the need of a destructor? Explain with the help of an example.

564


How many types of scopes are there in c++?

574


What is the header file for setw?

573


Why are pointers used?

578


What are the advantages of using friend classes?

622


what is a reference variable in C++?

657