OK thats not a back pack. You carry it like a briefcase or use the shoulder strap. *You* try strapping an ATX case with power supply and hard drives to your back. hahaha. (OK, that was really la...
Oh, dean, give me your best guess as to how I wrote the comment threading algorithm on here to work.
ok hmm I gave you the linear "hack" solution. Now here's how I'd do it in Java using objects and recursion.
**************************************************************************
Have a class called Node that contains all comment specific information plus an Enumeration of Node objects (children Nodes). Initially, go through all elements of the table, creating new Node objects with comment specific information, and *initially empty* Child Node List. For simplicity's sake, we have a method called void addNode(Node x) which adds the specified Node to *this* Node's child List. Put these newly created Nodes into a hash table, with hash keyed on comment number.
Oh, I almost forgot. Create a root Node with comment id = -1.
**************************************************************************
One could populate the Node Tree by going through the hash linearly (1,2,3...) and for each Node found, get a reference to its parent from the hash into a variable named "parent", and calling parent.addNode(this); This will give you a Comment node tree.
**************************************************************************
The tree is then printed recursively. printNodeAndChildren(Node rootNode) is called. It (1) prints current Node's info. (2a)(if children exist) for each child x (in Enumeration) calls printNodeAndChildren(x) and returns. (2b)(no children) just returns.
**************************************************************************