Binary Tree Dispatch
Created on 2020-08-19T22:00:57.384695
Binary tree dispatch uses "binary search" to find where a message should be sent.
- For example Milk, Eggs and Ice Cream may be assigned numbers 1, 7 and 9.
- You then have a map of numbers to particular responses to a given message.
- You would then run a binary search this table to find the response you are looking for.
There are O(log(n)) tests involved and there are only simple comparison operators involved; so this is cheaper than ex. having to find buckets in a hash table and compare keys. But only to a point.