algorithm - (merge sort) is log from n log n on base 2? -
this question has answer here:
- is big o(logn) log base e? 6 answers
- big o notation log base 2 or log base 10 [duplicate] 3 answers
- rough estimate of running time big o 4 answers
i've learned in class merge sort o(n · log(n)), i'm not clear on whether it's o(n · log2(n)) or o(n · log10(n)). i've read on stack overflow (at big o notation log base 2 or log base 10) "it not matter" because give approximately same runtime; want exact runtime. example, know bubble sort 512 elements takes 512²/2 − 512/2 = 130816 time units; merge sort 512 elements take 512 · 9 = 4608 time units, or 512 · 5.404 = 2767 time units?
since merge sort divides arrays halves, yup, base 2. comments say, base constant factor it's not important in big o notation.
Comments
Post a Comment