LYRivers
asked on
How do I write a function in a singly linked list of integers
How do I write a function to remove all nodes with even values in a singly linked list of integers.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Deleting from a linked list
http://www.cs.bu.edu/teaching/cs112/spring-2000/linked-list-delete/
Linked lists
http://en.wikipedia.org/wiki/Linked_list
http://www.inquiry.com/techtips/cpp_pro/10min/10min0599.asp
http://www.cs.bu.edu/teaching/cs112/spring-2000/linked-list-delete/
Linked lists
http://en.wikipedia.org/wiki/Linked_list
http://www.inquiry.com/techtips/cpp_pro/10min/10min0599.asp
@oleber, which bit of, "I've not provided any code at this time as you don't clarify whether this is an assignment or not." did you struggle with?
BTW: Won't your code leak memory since you don't preserve pointer->next before overwriting it with pointer->next->next?
BTW: Won't your code leak memory since you don't preserve pointer->next before overwriting it with pointer->next->next?
First of all, I didn't read your answer, before I get my answer
I wrote 'Something like this shall work' since this isn't the final code, is more a pseudocode
and he also has to check if basePointer is null at the beggining
I wrote 'Something like this shall work' since this isn't the final code, is more a pseudocode
and he also has to check if basePointer is null at the beggining
ASKER
Hi evilrix & oleber. Thanks very much for the information. It's not an assignment as I'm not a student -- I was many years ago, though! I have noted in my profile why I'm asking certain questions. Thanks for the prompt responses.
ASKER
The information was enough to add to a 2nd post and help me get closer to solving the problem. I currently work as a tester and program in SQL and limited VB script. I'm preparing for a technical interview and this is one of the problems that I was told to study. Thanks for your assistance.
Something like this shall work
Open in new window