I created a linked list that will store a string in each node. The problem is it is an ordered list and i don't know how to put where it needs to.
I don't need an algorithm, i just want an advice on how to compare two strings and knowing which is in the first or last. Or is less than or greater than.
I've just about used everything i had at my disposal and wonder if anyone here has got a fix.
Start with the root (lowest) node. Compare the string to be inserted with the string in the root node. If the string to be inserted is lower, then create a new node with the new string. It becomes the new root node and points to the previous root node. If the string to be inserted is higher than the string in the root node, advance to the next node and repeat the process. You need to think about how you're going to handle the case where the string is already in the linked list. If you get to the end of the linked list (the string to be inserted is > than any node), create a new node and link the last node to the new node.