🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by A Mohap Sun, 11 Apr 1999 00:00
HELP c++ linked list
#179
Author: A Mohap
Date: Sun, 11 Apr 1999 00:00
25 lines
1370 bytes
I am trying to make a kind of linked list in c++. The linked list will
maintain sorted doubles. This would look something like this:

struct Node {
 double data;
 Node *next;
};

This is easy to do BUT in addition to this my linked list has to maintain
two orders: one taking sign into consideration and another that doesn't care
about the sign. So I think the data structure for this looks like this:

struct Node {
 double data;
 Node *nextSigned,*nextUnsigned;
};

I have successfully linked all the elements that take sign into account by
using an add function that appends the data in order. but how do i link the
unsigned parts together?

Example:
If the data was -2,5,3,-1
sorted list1: -2,-1,3,5  ---> I've done this successfuly
sorted list2: -1,-2,3,5  ---> HOW TO DO ThIS LIST?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads