Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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"?

Answers were Sorted based on User's Feedback



Can we remove an element in a single linked list without traversing? Lets suppose the link list i..

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

Can we remove an element in a single linked list without traversing? Lets suppose the link list i..

Answer / santosh patil

just copy elements from 5th to 4th den 6th to 5th n so
on.....at last delete the last node r set it to null

Is This Answer Correct ?    0 Yes 0 No

Can we remove an element in a single linked list without traversing? Lets suppose the link list i..

Answer / codeg

it is not possible in Single AND double linked list without
traversing from first and not knowing addr of 4..
its possible in circular doubly linked list only........

Is This Answer Correct ?    0 Yes 0 No

Can we remove an element in a single linked list without traversing? Lets suppose the link list i..

Answer / vishal jagani

yes u can it link list(doubly),....

Is This Answer Correct ?    2 Yes 3 No

Can we remove an element in a single linked list without traversing? Lets suppose the link list i..

Answer / pradeep

its possible only if it is a doubly linked list.

Is This Answer Correct ?    3 Yes 6 No

Can we remove an element in a single linked list without traversing? Lets suppose the link list i..

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

More C++ General Interview Questions

What is meant by iomanip in c++?

0 Answers  


What are the sizes and ranges of the basic c++ data types?

0 Answers  


What is isdigit c++?

0 Answers  


What are the general quetions are in DEna bank manager IT/System interviews?

0 Answers   Dena Bank, ICICI,


which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?

0 Answers  


What are the 3 levels of programming languages?

0 Answers  


What will the line of code below print out and why?

0 Answers  


Memory is not a constraint. In a single iteration(NOTE: you can't go back), how will you find out the 10th last node/item in a linked list.

16 Answers   BNB, FDS, Goldman Sachs, Nagarro,


Can I uninstall microsoft c++ redistributable?

0 Answers  


How do you allocate and deallocate memory in C++?

1 Answers  


What is difference between n and endl in c++?

0 Answers  


What are the total number of lines written by you in C/C++? What is the most complicated or valuable program written in C/C++?

2 Answers   Intel,


Categories