Binary Trees

Hello,

I am working in a project to make a dictionary with all words of my contry and I am using Binary Trees.
The problem is that I do not know how to compare words with each other.

Help me if you can.
string a;
string b;

if(a < b)
...

that will work, but the comparison assumes the alphabet in your country is ordered in the unicode or ascii etc table for the characters correctly, and it also needs to be upcased or lowercased for best results, or a workable pattern like first letter only caps, rest lower, ... you will get poor results if you are not careful with case.

If your alphabet is not orderly in the table you use, it may need a custom comparison solution. A simple class comparison operator overload will do the trick.

you should be able to test how it behaves by comparing one letter "words" and validating the expected result.



Last edited on
Thank You.
Topic archived. No new replies allowed.