Binary Search Tree Insert

First post of mine, feedback welcomed.

I have made a BST class, and it works.
The problem now is that I have a Record class with two float member variables. At the moment I can only Insert to the Tree on one of those values, and was wondering how I would go about changing it so that I could insert on either, when needed.

Code can be provided, it is a recursive Insert currently.
A BST should only key off one key, or it won't be sorted anymore.
You can set it up so that it keys off one or the other, lots of ways to do that, but it can only use one of them for all records, that is, you can't key off X for record 1 and Y for record 2.

you can make your node/data/etc class (the thing the tree is built from) have a static member (same for all instances of the class) that tells it which of the 2 keys to use and a method to set this via user input or however.


Topic archived. No new replies allowed.