For this task, save your work in hw2.pdf In class, our ArrayList implementation uses the array doubling trick, which doubles the capacity of the array every time the array becomes full. Our analysis shows that starting with an array of capacity 1 with no data items initially, appending n data items ends up needing at most 2n copying steps. Homework 2 2 Data Struct. This problem involves a more fancy array growing scheme. To describe this new approach, recall the Fibonacci sequence from Discrete Math, which is given by Fn+2Fn+1+Fn for n ≥ 0, with F₁ = F2 = 1. In our new scheme, the capacity of the underlying array will strictly follow the Fibonacci sequence. Initially, the capacity is F2 = 1. When full, we grow the capacity to F3 = 2. When full again, we grow the capacity to F4 = 3... then to F5 = 5, then to F6 = 8, and so on. Amazingly this turns out to work quite well! You'll prove a few facts about Fibonacci numbers and apply them to analyze the total copying steps. Subtask I Using mathematical induction, prove that for n ≥ 1, 1+F+F2+... Fn = Fn+2 You're expected to write a solid, rigorous proof based on the definition of Fibonacci numbers (above). Subtask II Prove, e.g., using direct proof that for n ≥ 1, Fn (1+) 53 k=1 Subtask III Suppose we start with no data items in our ArrayList. If we use the Fibonacci growth scheme and add in n data items, give a detailed analysis of the total number of copy steps (like we did in class) of this scheme. State your argument carefully. To simplify matters, you may wish to assume that n = F+ + 1 for some integer r≥2.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16PE: The implementation of a queue in an array, as given in this chapter, uses the variable count to...
icon
Related questions
Question
For this task, save your work in hw2.pdf
In class, our ArrayList implementation uses the array doubling trick, which doubles the capacity of
the array every time the array becomes full. Our analysis shows that starting with an array of capacity 1
with no data items initially, appending n data items ends up needing at most 2n copying steps.
Homework 2
2
Data Struct.
This problem involves a more fancy array growing scheme. To describe this new approach, recall
the Fibonacci sequence from Discrete Math, which is given by
Fn+2Fn+1+Fn
for n ≥ 0,
with F₁ = F2 = 1. In our new scheme, the capacity of the underlying array will strictly follow the Fibonacci
sequence. Initially, the capacity is F2 = 1. When full, we grow the capacity to F3 = 2. When full again, we
grow the capacity to F4 = 3... then to F5 = 5, then to F6 = 8, and so on.
Amazingly this turns out to work quite well! You'll prove a few facts about Fibonacci numbers and
apply them to analyze the total copying steps.
Subtask I Using mathematical induction, prove that for n ≥ 1,
1+F+F2+... Fn = Fn+2
You're expected to write a solid, rigorous proof based on the definition of Fibonacci numbers
(above).
Subtask II Prove, e.g., using direct proof that for n ≥ 1,
Fn
(1+) 53
k=1
Subtask III Suppose we start with no data items in our ArrayList. If we use the Fibonacci growth scheme and
add in n data items, give a detailed analysis of the total number of copy steps (like we did in class)
of this scheme. State your argument carefully. To simplify matters, you may wish to assume that
n = F+ + 1 for some integer r≥2.
Transcribed Image Text:For this task, save your work in hw2.pdf In class, our ArrayList implementation uses the array doubling trick, which doubles the capacity of the array every time the array becomes full. Our analysis shows that starting with an array of capacity 1 with no data items initially, appending n data items ends up needing at most 2n copying steps. Homework 2 2 Data Struct. This problem involves a more fancy array growing scheme. To describe this new approach, recall the Fibonacci sequence from Discrete Math, which is given by Fn+2Fn+1+Fn for n ≥ 0, with F₁ = F2 = 1. In our new scheme, the capacity of the underlying array will strictly follow the Fibonacci sequence. Initially, the capacity is F2 = 1. When full, we grow the capacity to F3 = 2. When full again, we grow the capacity to F4 = 3... then to F5 = 5, then to F6 = 8, and so on. Amazingly this turns out to work quite well! You'll prove a few facts about Fibonacci numbers and apply them to analyze the total copying steps. Subtask I Using mathematical induction, prove that for n ≥ 1, 1+F+F2+... Fn = Fn+2 You're expected to write a solid, rigorous proof based on the definition of Fibonacci numbers (above). Subtask II Prove, e.g., using direct proof that for n ≥ 1, Fn (1+) 53 k=1 Subtask III Suppose we start with no data items in our ArrayList. If we use the Fibonacci growth scheme and add in n data items, give a detailed analysis of the total number of copy steps (like we did in class) of this scheme. State your argument carefully. To simplify matters, you may wish to assume that n = F+ + 1 for some integer r≥2.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning