Question: Graph (f_1(n) = n log n), (f_2(n) = n^{1.5}), and (f_3(n) = n^2) in the range (1 leq n leq 1000) to visually compare their
Graph \(f_1(n) = n \log n\), \(f_2(n) = n^{1.5}\), and \(f_3(n) = n^2\) in the range \(1 \leq n \leq 1000\) to visually compare their growth rates. Typically, the constant factor in the running-time expression for an implementation of Insertion Sort will be less than the constant factors for Shellsort or Quicksort. How many times greater can the constant factor for be for Shellsort to be faster than Insertion Sort when \(n = 1000\)? How many times greater can the constant factor be for Quicksort to be faster than Insertion Sort when \(n = 1000\)?
Step by Step Solution
3.52 Rating (152 Votes )
There are 3 Steps involved in it
import matplotlibpyplot as plt import numpy as np Define functions def f1n return n nplogn def f2n r... View full answer
Get step-by-step solutions from verified subject matter experts
