By using the binary tree in Figure 1; (a) List the nodes that are visited by the function insert to insert 87 into the tree in Figure 1. (b) What is the height of the tree after inserting 87? (c) Redraw the tree after inserting 87. (d) List the nodes that are visited by the function insert to insert 79 into the tree in Figure 1. (e) What is the height of the tree after inserting 79? (f) Redraw the tree after inserting 79.

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

By using the binary tree in Figure 1;

(a) List the nodes that are visited by the function insert to insert 87 into the tree in Figure 1.

(b) What is the height of the tree after inserting 87?

(c) Redraw the tree after inserting 87.

(d) List the nodes that are visited by the function insert to insert 79 into the tree in Figure 1.

(e) What is the height of the tree after inserting 79?

(f) Redraw the tree after inserting 79.

## Binary Tree Structure

The image depicts a binary tree data structure. 

### Description of the Binary Tree:

- **Root Node**: The topmost node is 70.

#### Left Subtree:
- **Level 1**: The root node has two children. The left child is 60 and the right child is 92.
  
- **Level 2 - Left Subtree (of 60)**:
  - Node 60 has two children: 50 (left) and 63 (right).
  
- **Level 3 - Left Subtree (of 50)**:
  - Node 50 has two children: 40 (left) and 45 (right).
  
- **Level 4 - Left Subtree (of 40)**:
  - Node 40 has two children: 20 (left) and 35 (right).

- **Level 4 - Right Subtree (of 63)**:
  - Node 63 has two children: 68 (left) and 65 (right).

#### Right Subtree:
- **Level 2 - Right Subtree (of 92)**:
  - Node 92 has two children: 82 (left) and 94 (right).

- **Level 3 - Left Subtree (of 82)**:
  - Node 82 has two children: 72 (left) and 88 (right).

- **Level 3 - Right Subtree (of 94)**:
  - Node 94 has two children: 98 (left) and 96 (right).

- **Level 4 - Left Subtree (of 72)**:
  - Node 72 has two children: 75 (left) and 80 (right).

- **Level 4 - Right Subtree (of 88)**:
  - Node 88 has two children: 85 (left) and 78 (right).

### Key Points:

1. **Binary Tree**: Each node has at most two children.
2. **Hierarchy**: The tree depicts a hierarchical structure with parent-child relationships.
3. **Leaf Nodes**: The nodes without any children (e.g., 20, 35, 45, 65, 68, 75, 85, 78, 80, 96, 98) are called leaf nodes.
4. **Internal Nodes**: Nodes with at least one child (e.g.,
Transcribed Image Text:## Binary Tree Structure The image depicts a binary tree data structure. ### Description of the Binary Tree: - **Root Node**: The topmost node is 70. #### Left Subtree: - **Level 1**: The root node has two children. The left child is 60 and the right child is 92. - **Level 2 - Left Subtree (of 60)**: - Node 60 has two children: 50 (left) and 63 (right). - **Level 3 - Left Subtree (of 50)**: - Node 50 has two children: 40 (left) and 45 (right). - **Level 4 - Left Subtree (of 40)**: - Node 40 has two children: 20 (left) and 35 (right). - **Level 4 - Right Subtree (of 63)**: - Node 63 has two children: 68 (left) and 65 (right). #### Right Subtree: - **Level 2 - Right Subtree (of 92)**: - Node 92 has two children: 82 (left) and 94 (right). - **Level 3 - Left Subtree (of 82)**: - Node 82 has two children: 72 (left) and 88 (right). - **Level 3 - Right Subtree (of 94)**: - Node 94 has two children: 98 (left) and 96 (right). - **Level 4 - Left Subtree (of 72)**: - Node 72 has two children: 75 (left) and 80 (right). - **Level 4 - Right Subtree (of 88)**: - Node 88 has two children: 85 (left) and 78 (right). ### Key Points: 1. **Binary Tree**: Each node has at most two children. 2. **Hierarchy**: The tree depicts a hierarchical structure with parent-child relationships. 3. **Leaf Nodes**: The nodes without any children (e.g., 20, 35, 45, 65, 68, 75, 85, 78, 80, 96, 98) are called leaf nodes. 4. **Internal Nodes**: Nodes with at least one child (e.g.,
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Binomial Heap
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
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