So I was wondering how other people would go about this, I'm doing a project for my Data Structures course (now the second I've taken because this college didn't accept the class from my last school, but that's unimportant).
I need to make a tree that's not simply a binary tree, but a tree with an unknown set of nodes on each branch (it doesn't need to be a template because it simply contains strings on each one; basically I'm putting sentences into this tree, word by word, which will branch off into a new sentence when the sentence being inserted starts differing from the others.
In theory, most sentences don't often end up being all that different after the first two words, so theoretically a binary tree would be fine, but it has to be set up for any situation.
I was wondering if I should just continue as I'm doing, where I make a vector of objects whose main data field is a vector (vector of vectors), but then is that technically a tree?
All ideas, hints, clues, witty sayings, etc. will be greatly appreciated.
There are instances where you would have more than one item per node - balanced search trees are examples of such - it all depends on one's application needs.
If the tree is for some type of compression algorithm, then it might be better to choose the option where each node can store multiple items via vector of strings + also store a vector of node pointers.
This way you can still define a head/root pointer for your tree.