I'm reading the book "Introduction to algorithms" and want to solve one task from it. But don't know the best way how to find solution.
The task is:
We have 2 sorting algorithms. Сomplexity of first one is $8 n^2$, the second is $64 n \lg n$. I want to find the range of $n$ when first algorithm is better than second.
I understand different ways how to solve it:
- I can take numbers one by one from range $[2..n]$ an find both values. According to them find a place when values of first algorithm become greater than second.
I understand that I can solve $8 n ^2$ < $64 n \lg n$. But have no idea how to do it. Maybe someone can assist with it or give a link where to read.
I can build graphics and find intersection point. But I had a problem with it. I don't want to build them on the paper. I found such online programm as Sage. But I can't find how to build graphic for logarithm. I'm trying:
a=plot(8*n^2)
b=plot(64*n*log(10, n), rgbcolor='red')
(a+b).show()
But it's not working. Maybe somebody can help with it? And what is the most popular programm for such mathematics tasks?
To get the graphics, put:
in google. You will get the graph of the two functions and "see" the interval requested.