lec2 - Lecture 2 Trees for representation Tries, decision...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Page 1 of 26 CSE 100, UCSD: LEC 2 Lecture 2 Trees for representation Tries, decision and classification trees, discrimination nets Huffman coding Reading: Weiss, Ch 10
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Page 2 of 26 CSE 100, UCSD: LEC 2 20 questions Suppose you’re playing the game of 20 questions for famous people The rules of the game are: I start by thinking of the name of a famous person. You ask a a yes-or-no question; I give you the answer to that question. Based on my answer, you ask another yes-or-no question, etc. You cannot ask more than 20 yes-or-no questions! If you guess the name of the person I have in mind with one of your questions, you win; otherwise, you lose. If you had to think up a fixed question-asking strategy for this game in advance of playing it, what is the maximum number of famous people for which the strategy could win?
Background image of page 2
Page 3 of 26 CSE 100, UCSD: LEC 2 Strategies for 20 questions; and trees Note that a strategy for playing the 20 questions game has a binary tree structure: The first question you ask corresponds to the root node of the tree If you get a “yes” answer to the first question, the next question you ask corresponds to a child of the root If you get a “no” answer to the first question, the next question you ask corresponds to the other child of the root In playing this strategy against an opponent, each game involves following a path from the root towards the leaves If you get a “yes” answer to a name-guessing question, you WIN! If you get a “no” answer, the game continues (unless that was your 20th question, in which case you LOSE)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Page 4 of 26 CSE 100, UCSD: LEC 2 A (partial) 20-questions strategy tree is the person alive? was the person a woman? is the person a woman? was he an actor? was he a musician? is she an actress? Jerry Garcia? WIN! was he a jazz player? is she a politician? y y y y n n n n n n n y y y Hilary Clinton? is she a scientist? y y y n n n WIN! y n ... ... ... ... ... ... ... ... ...
Background image of page 4
Page 5 of 26 CSE 100, UCSD: LEC 2 Optimal 20-questions trees Counting only nodes with questions in them (not WIN or LOSE nodes), what is the maximum number of levels in a 20-questions strategy tree? _________ A 20-questions strategy tree that can win for the greatest number of famous people I might have in mind will be one that has the most “WIN” nodes of any strategy tree with that many levels. What form would this tree take? It would be a completely filled binary tree, with all of the name-guessing nodes at the lowest level Each of those name-guessing nodes would have one “WIN” node associated with it How many WIN nodes are there in such a tree? __________
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Page 6 of 26 CSE 100, UCSD: LEC 2 Strategy trees as data structures Note that a strategy tree for the 20 questions game can at the same time be used as a data structure to store and retrieve names of famous people Each famous person in the tree can be represented by the sequence of yes/no answers that leads to that person’s name-guessing question node, in that tree
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

lec2 - Lecture 2 Trees for representation Tries, decision...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online