Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
6th Edition
ISBN: 9781118771334
Author: Michael T. Goodrich
Publisher: WILEY
Expert Solution & Answer
Book Icon
Chapter 4, Problem 6R

Explanation of Solution

Sum of all even numbers from 0 to 2n:

If the sum is even number of integers that is “E(n)”, then it is clear that the sum of all even numbers is “2S(n)”.

Here, “S(n)” denotes that sum of all integers from “1” to “n” and the sum of all even integers is “n(n+1)”.

Proof:

Let us prove the result by following induction,

For base case “n=1 ”,

  • Assume that “Sum (2×i)” for the value i=0…n is “n(n+1)
  • It is the same for “n+1”.
  • Sum(2×i)” for i=0…n+1=(n+1)((n+1)+1)=(n+1)(n+2) = n2+3n+2

Blurred answer
Students have asked these similar questions
Let n be an integer. If 3n+ 4 is odd, then n is odd.
Provide a counter example for: The number n is an even integer if and only if 3n + 2 is an even integer.
Give asymptotic upper and lower bounds for each of the following recurrences. Justify your answer.

Chapter 4 Solutions

Data Structures and Algorithms in Java

Knowledge Booster
Background pattern image
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