Is there an algorithm for finding an item that matches certain properties, like a 20 questions game?
Posted
by lala
on Stack Overflow
See other posts from Stack Overflow
or by lala
Published on 2010-05-14T16:19:07Z
Indexed on
2010/05/14
16:24 UTC
Read the original article
Hit count: 196
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?
© Stack Overflow or respective owner