Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

Question 2 only please.

Transcribed Image Text:2. Given the following recursive algorithm: procedure sum(x, y) Input: x: nonnegative integer, y: nonnegative integer Output: x+y: nonnegative integer if y==0 then return x else return sum(x, y-1) + 1 Prove that sum(x, y) returns x+y for any nonnegative integers x and y.
[画像:Part I: Induction Prove each of the following statements using induction, strong induction, or structural induction. For each statement, answer the following questions. а. Complete the basis step of the proof. b. What is the inductive hypothesis? C. What do you need to show in the inductive step of the proof? d. Complete the inductive step of the proof. 1. Let S be the set of perfect binary trees, defined as: • Basic step: a single vertex with no edges is a perfect binary tree T,. • Recursive step: if T1 and T2 are perfect binary trees of the same height, then a new perfect binary tree T' can be constructed by taking T1 and T2, adding a new vertex v, and adding edges between v and the roots of T, and T2. Prove that h(T) = log2(n(T) + 1) – 1 for any perfect binary tree T, where n(T) is the number of vertices of T and h(T) is the height of T. Hint: Remember that h(T,) = h(T2) and n(T,) = n(T,). Also remember that h(T') = h(T,) + 1 and n(T') = n(T,) + n(T2) + 1. ]
expand button
Transcribed Image Text:Part I: Induction Prove each of the following statements using induction, strong induction, or structural induction. For each statement, answer the following questions. а. Complete the basis step of the proof. b. What is the inductive hypothesis? C. What do you need to show in the inductive step of the proof? d. Complete the inductive step of the proof. 1. Let S be the set of perfect binary trees, defined as: • Basic step: a single vertex with no edges is a perfect binary tree T,. • Recursive step: if T1 and T2 are perfect binary trees of the same height, then a new perfect binary tree T' can be constructed by taking T1 and T2, adding a new vertex v, and adding edges between v and the roots of T, and T2. Prove that h(T) = log2(n(T) + 1) – 1 for any perfect binary tree T, where n(T) is the number of vertices of T and h(T) is the height of T. Hint: Remember that h(T,) = h(T2) and n(T,) = n(T,). Also remember that h(T') = h(T,) + 1 and n(T') = n(T,) + n(T2) + 1.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education