So we learned in classes that some algorithms perform better at certain times. On the homework assignment, We are asked to compare algorithm 1 which takes 4n4 days to run with one that takes 3n seconds to run. The question wants us to find at what n does the first algorithm outperforms the second. The following is my attempt at solving the problem.
I first disregarded the differences between seconds and days, since whatever I multiply to each will simply be constants and be ignored when comparing the Big O notation. The first algorithm runs in O(n4), while the second runs in O(3n)
My first instinct is to set both equal to each other to find at what n does Algorithm #1 equals to Algorithm #2
1. n4 = 3n
2. log(n4) = log(3n )
3. 4 log(n) = n log(3)
4. log(n) / n = log(3) / 4
At this point I am stuck at how to continue to find n. I googled around and the cloest solution I found is to use a formula named Newton's Method , but seeing that I have no idea what that method is, I don't think I am on the right track.
Please try to reference me to hints and examples if possible, and not the solution. I really want to understand what I am doing wrong instead of just copying down the answers somewhere. Any help would be greatly appreciated!