Midterm season is probably stressing you out. However good news! This is an excellent time to learn binary trees! Only you will be making the software learn this time as well! Construct a binary tree, where the default consists of a root with data value "is it a vertebrate?", and its two children will have "Bird" and "Snail" as their data value respectively. The goal of this program is to make the program guess what animal you are thinking of by asking you questions. Let me give you an example of how this works: For example in the code segment below, first you ask the user the question "is it a vertebrate?". Allow the user to respond with yes/no, if the user types yes, you ask the user "is it a bird?", if the user types no, you have to ask the user to type in the animal he/she was thinking of. Suppose the user types in dog, then you ask the user how you can distinguish bird from dog. And let's pretend the user types in "Does this animal have teeth?". The next time the user types in the same string of responses, the program should be able to guess dog. Welcome to the Animal Guessing Game! Is this animal a vertebrate? (yes/no): yes Is it a Bird (yes/no): no What animal were you thinking of?: dog What is a yes/no question that would distinguish dog from Bird?: Does this animal have teeth? I'll remember that for next time! Press 'q' to quit, press any other key to continue: p Is this animal a vertebrate? (yes/no): yes Does this animal have teeth? (yes/no): yes Is it a dog (yes/no): yes I guessed it right! Press 'q' to quit, press any other key to continue: q *Important: You can choose to play around with your machine learning masterpiece however, for the assignment, you will have to create the same tree as shown in the diagram below.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Im confused with this question. How am i supposed to program an binary tree based on these insturctions? This is suppoed to be done through c++ 

Its a bonous question so its not graded but i would like to attempt it 

Midterm season is probably stressing you out. However good news! This is an excellent time to
learn binary trees! Only you will be making the software learn this time as well! Construct a
binary tree, where the default consists of a root with data value "is it a vertebrate?", and its two
children will have "Bird" and "Snail" as their data value respectively.
The goal of this program is to make the program guess what animal you are thinking of by
asking you questions. Let me give you an example of how this works:
For example in the code segment below, first you ask the user the question "is it a vertebrate?".
Allow the user to respond with yes/no, if the user types yes, you ask the user "is it a bird?", if the
user types no, you have to ask the user to type in the animal he/she was thinking of. Suppose
the user types in dog, then you ask the user how you can distinguish bird from dog. And let's
pretend the user types in "Does this animal have teeth?". The next time the user types in the
same string of responses, the program should be able to guess dog.
Welcome to the Animal Guessing Game!
Is this animal a vertebrate? (yes/no): yes
Is it a Bird (yes/no): no
What animal were you thinking of?: dog
What is a yes/no question that would distinguish dog from Bird?: Does this animal have teeth?
I'll remember that for next time!
Press 'q' to quit, press any other key to continue: p
Is this animal a vertebrate? (yes/no): yes
Does this animal have teeth? (yes/no): yes
Is it a dog (yes/no): yes
I guessed it right!
Press 'q' to quit, press any other key to continue: q
*Important: You can choose to play around with your machine learning masterpiece however, for
the assignment, you will have to create the same tree as shown in the diagram below.
Transcribed Image Text:Midterm season is probably stressing you out. However good news! This is an excellent time to learn binary trees! Only you will be making the software learn this time as well! Construct a binary tree, where the default consists of a root with data value "is it a vertebrate?", and its two children will have "Bird" and "Snail" as their data value respectively. The goal of this program is to make the program guess what animal you are thinking of by asking you questions. Let me give you an example of how this works: For example in the code segment below, first you ask the user the question "is it a vertebrate?". Allow the user to respond with yes/no, if the user types yes, you ask the user "is it a bird?", if the user types no, you have to ask the user to type in the animal he/she was thinking of. Suppose the user types in dog, then you ask the user how you can distinguish bird from dog. And let's pretend the user types in "Does this animal have teeth?". The next time the user types in the same string of responses, the program should be able to guess dog. Welcome to the Animal Guessing Game! Is this animal a vertebrate? (yes/no): yes Is it a Bird (yes/no): no What animal were you thinking of?: dog What is a yes/no question that would distinguish dog from Bird?: Does this animal have teeth? I'll remember that for next time! Press 'q' to quit, press any other key to continue: p Is this animal a vertebrate? (yes/no): yes Does this animal have teeth? (yes/no): yes Is it a dog (yes/no): yes I guessed it right! Press 'q' to quit, press any other key to continue: q *Important: You can choose to play around with your machine learning masterpiece however, for the assignment, you will have to create the same tree as shown in the diagram below.
yes
Bird
Is it cold blooded?
yes
Does it fly?
Pig
yes
Frog
no
yes
Does it live in water exclusively?
no
Does it have legs?
no
Is it a vertebrate?
Snake
Fish
Does it have legs?
Į
Does it fly?
yes
Spider
no
Fly
Snail
Transcribed Image Text:yes Bird Is it cold blooded? yes Does it fly? Pig yes Frog no yes Does it live in water exclusively? no Does it have legs? no Is it a vertebrate? Snake Fish Does it have legs? Į Does it fly? yes Spider no Fly Snail
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Types of trees
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education