Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Multidimensional linked lists

Name: Anonymous 2011-12-23 9:01


namespace Multidimensional {
        Template<class T> class List; // To allow pointers to lists
        Template<class T> class List {
                List<T> *Up;
                List<T> *Down;
                List<T> *Left;
                List<T> *Right;
                T Data;
        public:
                T Element(unsigned int x, unsigned int y) {
                        // To be defined later. I'm sleepy
                }
                void InsertElement(T data, unsigned int x, unsigned int Y) {
                        // To be defined later. It's six in the damn morning!
                }
                List() {
                        Up    = NULL;
                        Down  = NULL;
                        Left  = NULL;
                        Right = NULL;
                }
        };
};


How would you make a multidimensional linked list /prog/?

Name: Anonymous 2011-12-23 9:28

struct Node {
    void *this; // contents of the node
    int dimensions; // number of dimensions
    struct Node *nodes; // array of next nodes in all the dimensions
};


Note that the number of dimensions could even change from node to node, though I don't see anything useful in that.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List