How can i Adding node after certain ID ?

Recommended Answers

Follow the list until you get to the specified ID then insert the new node after it.

Jump to Post

All 4 Replies

Add a node to what? The answer depends on what kind of data structure you are adding to. What have you tried so far?

sorry.... for linked list

Follow the list until you get to the specified ID then insert the new node after it.

And if the list is null, create a new list with the incoming node data. If you don't find the specified ID in the list, insert it at the end of the list.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.