linked list find

This is a discussion on linked list find within the C++ Programming forums, part of the General Programming Boards category; I don't know why I'm having so much trouble with this. It seems like it should be easy. I have ...

linked list find

I don't know why I'm having so much trouble with this. It seems like it should be easy. I have a linked list class (there are some other functions which make it more than a standard linked list, but they aren't important here). I'll paste in a simplified version of what I have. I realize that 0 can't be added to the list, but that's ok, because I don't ever need to - that is not the problem.

Re: linked list find

Originally posted by blackrat364 I don't know why I'm having so much trouble with this. It seems like it should be easy. I have a linked list class (there are some other functions which make it more than a standard linked list, but they aren't important here). I'll paste in a simplified version of what I have. I realize that 0 can't be added to the list, but that's ok, because I don't ever need to - that is not the problem.

It seems to me that 'linked_list' is actually a linked list node, and not the list itself (which I know is little more than a bunch of these things linked together). At any rate, it doesn't seem to make much sense to have your findlow function as part of the node.

What you could do without drastic changes though (just an idea), is to have each findlow function take a pointer to a node, and then compare its own data against that nodes... hard to explain, here's some pseudo-code:

I guess I was unclear in my original post. Darn AIM. I don't want to just determine which of two nodes has the smallest value for data... I want to find the smallest value of data in the entire list. Oh well, I'll work on it some more.