Question
What is the computational complexity of the operation COPY provided below expressed in terms of the size of the input list? Discuss both the array
What is the computational complexity of the operation COPY provided below expressed in terms of the size of the input list? Discuss both the array and the pointer implementations of the List ADT. Your estimates should be tight in both cases, i.e. the times spent on the execution of the operation COPY should be both "big oh" and "big omega" of your functions. Justify your answer.
procedure COPY( K: LIST; var L: LIST ); var p: position; begin MAKENULL(L); p := FIRST(K); while p <> END(K) do begin INSERT(RETRIEVE(p, K), END(L), L); p := NEXT(p, K) end end; { COPY }
Step 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