Question
Helppppppppp please on 2g and 2h ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. (f) (4 points) Let's be clever about this... suppose we build an array A whose size is the
Helppppppppp please on 2g and 2h
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
(f) (4 points) Let's be clever about this... suppose we build an array A whose size is the same as B. but whose entries are cumulative total mass collected since the first week What is the running time to build such a structure, and how much space does it use? (We are not asking you to show us the pseudocode solution to this problem, but you should sketch it out in order to answer the question!) Time Space: (g) (4 points) Give an expression in terms of the new array A that can be used to answer queries like "what is the total mass of batteries collected between week 0 and week j Expression: Time h) (4 points) Give an expression in terms of the new array A that can be used to answer queries like "what is the total mass of batteries collected between week i and week j (inclusive)?" Also tell us the running time for answering the query. C 221 Winter 1, 2018 Expression: TimeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started