A question about 20 questions games was asked here:
However, if I'm understanding it correctly, the answers seem to assume that each question will go down a hierarchal branching tree. A binary tree should work if the game went like this:
- Is it an animal? Yes.
- Is it a mammal? Yes.
- Is it a feline? Yes.
Because feline is an example of a mammal and mammal is an example of an animal. But what if the questions go like this?
- Is it a mammal? Yes.
- Is it a predator? Yes.
- Does it have a long nose? No.
You can't branch down a tree with those kinds of questions, because there are plenty of predators that aren't mammals. So you can't have your program just narrow it down to mammal and have predators be a subset of mammals.
So is there a way to use a binary search tree that I'm not understanding or is there a different algorithm for this problem?
Just to clarify, I'm only using 20 questions as an example, so my question is about this kind of search problem in general, not other problems involved specifically in a 20 questions game.