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 and Binary Trees: A Learning Opportunity**

Midterm season can be stressful, but here’s some good news! It’s a great time to learn about binary trees, and you’ll get to enhance your software learning skills simultaneously. In this activity, you'll construct a binary tree with a default root question, "Is it a vertebrate?" The initial child nodes will be "Bird" and "Snail," each with corresponding data values.

**Objective:**
Create a program that can deduce an animal based on user responses to a series of questions.

**Example Interaction:**

The program begins by asking, "Is it a vertebrate?" Users respond with "yes" or "no." If "yes," the follow-up question is, "Is it a bird?" When users respond "no," the program asks them to specify which animal they were thinking of. For example, if the user suggests "dog," the program will prompt for a distinguishing question, such as "Does this animal have teeth?" The program stores this new information, enabling it to guess "dog" in future interactions when users provide the same answers.

**Sample Code Interaction:**

```
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
```

**Note:**
Feel free to innovate with your machine learning project! For the assignment, you must construct a tree like the one detailed in the diagram provided.
Transcribed Image Text:**Midterm Season and Binary Trees: A Learning Opportunity** Midterm season can be stressful, but here’s some good news! It’s a great time to learn about binary trees, and you’ll get to enhance your software learning skills simultaneously. In this activity, you'll construct a binary tree with a default root question, "Is it a vertebrate?" The initial child nodes will be "Bird" and "Snail," each with corresponding data values. **Objective:** Create a program that can deduce an animal based on user responses to a series of questions. **Example Interaction:** The program begins by asking, "Is it a vertebrate?" Users respond with "yes" or "no." If "yes," the follow-up question is, "Is it a bird?" When users respond "no," the program asks them to specify which animal they were thinking of. For example, if the user suggests "dog," the program will prompt for a distinguishing question, such as "Does this animal have teeth?" The program stores this new information, enabling it to guess "dog" in future interactions when users provide the same answers. **Sample Code Interaction:** ``` 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 ``` **Note:** Feel free to innovate with your machine learning project! For the assignment, you must construct a tree like the one detailed in the diagram provided.
The diagram is a decision tree used for classifying animals based on specific characteristics. It begins with the question:

1. **Is it a vertebrate?**
   - **Yes:**
     - **Is it cold-blooded?**
       - **Yes:** 
         - **Does it fly?**
           - **Yes:** Bird
           - **No:** Frog
       - **No:** 
         - **Does it live in water exclusively?**
           - **Yes:** Fish
           - **No:**
             - **Does it have legs?**
               - **Yes:** Pig
               - **No:** Snake
   - **No:**
     - **Does it have legs?**
       - **Yes:** 
         - **Does it fly?**
           - **Yes:** Fly
           - **No:** Spider
       - **No:** Snail

This tree helps determine the type of animal by following a path based on simple yes or no questions, focusing on whether the animal is a vertebrate, its blood temperature, habitat, and anatomy such as the presence of legs and the ability to fly.
Transcribed Image Text:The diagram is a decision tree used for classifying animals based on specific characteristics. It begins with the question: 1. **Is it a vertebrate?** - **Yes:** - **Is it cold-blooded?** - **Yes:** - **Does it fly?** - **Yes:** Bird - **No:** Frog - **No:** - **Does it live in water exclusively?** - **Yes:** Fish - **No:** - **Does it have legs?** - **Yes:** Pig - **No:** Snake - **No:** - **Does it have legs?** - **Yes:** - **Does it fly?** - **Yes:** Fly - **No:** Spider - **No:** Snail This tree helps determine the type of animal by following a path based on simple yes or no questions, focusing on whether the animal is a vertebrate, its blood temperature, habitat, and anatomy such as the presence of legs and the ability to fly.
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.
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