cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
help getting logic for doubly linked lis
help getting logic for doubly linked list
Sep 19, 2013 at 4:37am UTC
MrHatchi87
(59)
Hey everyone,
I need a bit of help getting some logic down for a homework assignment. I need to delete the Nth node from a doubly linked list.
I know I just cant delete it out right. I have all the goodies including a templetized node class. I need help.
this is the code we're given:
1
2
3
4
5
6
7
8
template
<
typename
T>
void
doublyLinkedList<T>::deleteKthElement(
const
int
item) { }
It accepts an int, and should go to the Nth node and delete it.
I appreciate the help again. Not asking for the answer, just logic to write it
Sep 19, 2013 at 5:26am UTC
htirwin
(1208)
It's helpful to draw pictures to understand operations like this (circles and arrows or something). Then you just have to think about where the arrows (links) need to go after the node is deleted, and the code which makes it happen.
Last edited on
Sep 19, 2013 at 5:28am UTC
Topic archived. No new replies allowed.