3 ms·
It sounds like you're really very confused ... I'm no Computer Science major, but I've easily wasted a lot of my time rewriting algorithms for n. I'm not
by RiderOfGiraffes 18y ago
It sounds like you're really very confused ...
I'm no Computer Science major, but I've easily
wasted a lot of my time rewriting algorithms for n.
I'm not even sure what that means.
... tested a few out on my own ... in my browser ...
where n is 27. . .using 2^n, which is essentially
what a bubble-sort measures out at.
No, BubbleSort wuns in n^2. The difference is significant.
This is a bad algorithm, ...
No, it's only bad when the input gets beyond 10 or so, where 10 is not necessarily equal to 10. This is why O(n) notation is so important, so understand where the trade-offs occur.
2^27 = 134 217 728, which is roughly 130 MB.
No, MB is a measure of memory, and you're talking about measuring time. Further, the exponential example on your web page is not BubbleSort, it's Fibonacci. That is exponential, but the base isn't 2.
Firefox is willing and capable of running this while
it could even run 2^28 = 268 MB.
This is what convinces me that you're very confused about what is happening, and why. This stuff doesn't need a masters in CSCI or anything else. It's really very simple. It just sounds to me like you've read some bad tutorials, and done some irrelevant (although perhaps interesting) exercises, from which you've learned the wrong lessons.