How can i Adding node after certain ID ?

Recommended Answers

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 meeting, networking, learning, and sharing knowledge.