4

I'm looking in my book, and it doesn't explain it. Its telling me what a binary search tree is and it decided to use strings.

         Jared
        /     \
 Brittany      Megan
 /      \        /   \
Brett  Doug     Jim  Whitney

So supposedly, a node is greater than its left subtree and lesser than its right subtree. How is Jared greater than Brittany?

wnoise
  • 9,764
  • 37
  • 47
Strawberry
  • 66,024
  • 56
  • 149
  • 197

2 Answers2

5

In a dictionary, the word "Jared" would come after "Brittany".

http://en.wikipedia.org/wiki/Lexicographical_order

wnoise
  • 9,764
  • 37
  • 47
1

Using default string comparison rules, characters with larger integer codes makes string "larger" i.e. 'J' > 'B'. However there is lot of nuances in real life :)

Petr Abdulin
  • 33,883
  • 9
  • 62
  • 96