Question: Answer must be in racket ;************************************************************ ; ** problem 2 ** (15 points) ; For this problem, use your procedure time-calls ; to time the
Answer must be in racket ;************************************************************ ; ** problem 2 ** (15 points) ; For this problem, use your procedure time-calls ; to time the built-in Racket procedures: ; length, take, drop ; and report the following measurements, and answer the following questions. ; Comment out your responses with semicolons. ; For length, report measurements of 100 repetitions of calling length ; on a list of length k * 100,000 for k = 1,2,3,4. ; For take and drop, report measurements of 100 repetitions of calling take (or drop) ; on a list of length k * 100,000 for k = 1,2,3,4, with the number ; of elements to take (or drop) being half the length of the list. ; You may want to do several measurements because of random variation. ; For the procedures length, take, and drop, replace length-runtime, ; take-runtime, and drop-runtime with either O(1) or O(n) to most accurately ; reflect each procedure's respective running time as a function of the length n ; of the list argument. ; Compare the times taken by the three procedures on comparable inputs -- which is ; fastest? slowest? Replace length-take-drop-ordering with an ordering of these ; procedures. Then, in the space below, explain *why* on the basis of how lists and ; their operations are implemented. (Complex statistical analysis is not ; necessary.) ;************************************************************ ; Please comment out all parts of your answer that are not a definition. Do NOT delete ; the question prompts below. ; Please report measurements here. (define length-runtime "replace with either O(1) or O(n)") ; Please briefly comment below on how your measurements support this conclusion. (define take-runtime "replace with either O(1) or O(n)") ; Please briefly comment below on how your measurements support this conclusion. (define drop-runtime "replace with either O(1) or O(n)") ; Please briefly comment below on how your measurements support this conclusion. ; Please do not use commas, and please order from fastest to slowest ; e.g. (define length-reverse-powerset-ordering '(length reverse powerset)) (define length-take-drop-ordering '(fastest middle slowest)) ; Please explain your ordering here.
;************************************************************
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
