Earlier quoted context omitted.
I can't agree more, when interviewing I always ask this kind of questions of "theoretical knowledge" not to have the actual answer, but to see how candidates reacts when they don't know. Because if the guy not only admits he does not know directly and is eager to know what it is briefly, then you know that giving your team and environment is favorable to learning, the guy will soon be able to catch up, and it's certa…
How can anyone applying for a programming job not know Big-O notation? That's CS101. I don't care if you're self-taught, it's audacious to even call yourself a programmer if you don't know the very basics of algorithms and data structures. If I were interviewing a candidate, and it was revealed he didn’t know Big-O notation, my next questions would be about data structures, because now I’m suspecting he wouldn’t even…
Big-O notation explained by a self-taught programmer
41–50 of 58 posts
Re: Big-O notation explained by a self-taught programmer
#42The thing I always run into when discussing big-O are people (good programmers even) who think all O(x) algorithms have the same efficiency. I find it very frustrating when someone says my streamlined O(N) algo with 5 operations has the same efficiency as their O(N) algo with 20 extra function calls and operations. Big-O is not the only determining factor...
In a way Big-O notation intentionally glosses over these differences. At a large scale 5 vs 20 per instance of n doesn't matter. It might matter for practical purposes but Big-O really is about making broad distinctions.
Re: Big-O notation explained by a self-taught programmer
#43Earlier quoted context omitted.
> "That makes sense. Big-O notation is so overrated." Can you explain how having a classification that allows one to determine whether something is logarithmic vs vs quadratic is so overrated? Isn't that a bit like saying "Algebra is so overrated"? Also Donald Knuth introduced Big O somewhere around the mid 1970s and C++ didn't come along until 1979. https://en.wikipedia.org/wiki/Big_O_notation#cite_note-knuth... Als…
I think (hope?) that user5994461's post was tongue in cheek. BTW, you are way off saying Don Knuth introduced Big O. It was invented by physicists and mathematicians like Paul Bachmann and Landau, many decades before the 1970s.
Sure "O" goes back to mathematicians in the late 19th century. What I meant was that Knuth introduced Big O(mnicron) in the context of "Computer Science" literature.
This is the source I am referring to from 1976 SIGACT News:
http://www.phil.uu.nl/datastructuren/09-10/knuth_big_omicron...
On page 21 or page 4 of the PDF:
"I would like to close this letter by discussing a competing way to denote the order of function growth. My library research turned up the surprising fact that this alternative approach actually antedates the O-notation itself. "
On page 22 or page 5 of the PDF:
"The main reason why 0 is so handy is that we can use it right in the middle of formulas (and in the middle of English sentences and in tables which show the running times for a family of related algorithms etc.)."
Re: Big-O notation explained by a self-taught programmer
#44Earlier quoted context omitted.
Yes, however big O notation isn't about which programs run faster, it's about how the runtime of a program changes in response to the input size
...which is irrelevant depending on the bounds of the input size. It boils down to optimization. There's no point in spending time optimizing for Big-O if the input size will be so small the difference between O(n²) and O(n log n) doesn't matter. As with all optimizations, there are situations where it matters a lot. But in the real world there are plenty of situations where the time is better spent elsewhere or wher…
"f(n) = O(g(n)) means there are positive constants c and k, such that 0 ≤ f(n) ≤ cg(n) for all n ≥ k. "
Re: Big-O notation explained by a self-taught programmer
#45Earlier quoted context omitted.
In a way Big-O notation intentionally glosses over these differences. At a large scale 5 vs 20 per instance of n doesn't matter. It might matter for practical purposes but Big-O really is about making broad distinctions.
Yup. Achieving a better big-O could for example be the difference between something being possible or not, whereas fine-tuning an algo without altering its big-O might be the difference between needing five servers or ten. Still relevant, but a different class of relevance.
Re: Big-O notation explained by a self-taught programmer
#46Didn't know that the "O" in Big-O actually means "order". I guess it doesn't really matter too much. If you really wanted to get theoretical, you could also talk about the whole family, including little-O, big-omega, little-omega, etc. :)
I think O meaning order would be a retronym.
Re: Big-O notation explained by a self-taught programmer
#47Earlier quoted context omitted.
Sometimes. Sometimes you just need to throw things in the oven until the first one browns up. I recently had a problem where I needed an adjacency matrix of shortest paths. It was a choice between dijkstra and floyd-warshall. My dijkstra implementation kicked the pants off of floyd warshall for this application by an order of magnitude, which you wouldn't really expect. And the big-O complexity was the same for both…
A few comments just in case this a critical part of your program, and if running it faster would help: 1. Using a heap with Dijkstra's algorithm would speed up your program From your comment I am guessing you are using Dijkstra's algorithm without a heap, which gives O(n * m) for one source, and O(n^2 * m) for all sources (all pairs shortest path), where n is the number of nodes/vertices, and m is the number of edges…
Re: Big-O notation explained by a self-taught programmer
#48Earlier quoted context omitted.
Sometimes. Sometimes you just need to throw things in the oven until the first one browns up. I recently had a problem where I needed an adjacency matrix of shortest paths. It was a choice between dijkstra and floyd-warshall. My dijkstra implementation kicked the pants off of floyd warshall for this application by an order of magnitude, which you wouldn't really expect. And the big-O complexity was the same for both…
Yes and its good to know the limits of Big O as you mentioned Big O tells you what an upper bound on something is but it will provide no answer as to which to which of two algorithms with the same upper bound will be faster. There is a field that deals with this and I watched some lectures by Robert Sedgewick called "Analytic Combinatorics" where he talks about a different analysis to do just that. He talks about bei…
Does he delve into the nuts and bolts of data structure for this, or does it stay more theoretical?
Re: Big-O notation explained by a self-taught programmer
#49Earlier quoted context omitted.
Sometimes. Sometimes you just need to throw things in the oven until the first one browns up. I recently had a problem where I needed an adjacency matrix of shortest paths. It was a choice between dijkstra and floyd-warshall. My dijkstra implementation kicked the pants off of floyd warshall for this application by an order of magnitude, which you wouldn't really expect. And the big-O complexity was the same for both…
A few comments just in case this a critical part of your program, and if running it faster would help: 1. Using a heap with Dijkstra's algorithm would speed up your program From your comment I am guessing you are using Dijkstra's algorithm without a heap, which gives O(n * m) for one source, and O(n^2 * m) for all sources (all pairs shortest path), where n is the number of nodes/vertices, and m is the number of edges…
Re: Big-O notation explained by a self-taught programmer
#50Earlier quoted context omitted.
Yes and its good to know the limits of Big O as you mentioned Big O tells you what an upper bound on something is but it will provide no answer as to which to which of two algorithms with the same upper bound will be faster. There is a field that deals with this and I watched some lectures by Robert Sedgewick called "Analytic Combinatorics" where he talks about a different analysis to do just that. He talks about bei…
I will have to check this out as I'm in a lot of places where speed matters these days. Does he delve into the nuts and bolts of data structure for this, or does it stay more theoretical?
Video Lectures are here: https://www.coursera.org/learn/analysis-of-algorithms
and the book:
http://aofa.cs.princeton.edu/home/
Also a youtube - short history of algorithm analysis by Sedgewick is worth a watch: