What exactly is the constant in regards to algorithms from CLRS?

59 Views Asked by At

Afternoon guys and gals,

First and foremost, I hope all is well. I have been reviewing CLRS 3rd edition and was wondering exactly what is the constant value in regards to algorithm. (a.k.a where is it visualized/manifested in the code)

For instance, CLRS 3rd Edition describes how “insertion sort, takes time roughly equal to c1n2 to sort n items, where c1 is a constant that does not depend on n. That is, it takes time roughly proportional to n2.” (p. 12)

  • Is the constant derived from simply how you implement/modify you insertion sort algorithm? Any specific example would be tremendously helpful.
  • Also, are we to assume that the constants will always/eventually be less than n2 and thus we can ignore it?
0

There are 0 best solutions below