9

// O(n²) complexity
for(x;y;z){
for(a;b;c){
}
}

Dev's argument: "We use this everywhere, as long as it gets the job done! Time is money!" How ironic..

So you would rather make your processing speed suffer for the sake of saving time? No, clean code doesn't matter. No, we should not waste time spending even a mere microsecond thinking about writing better code or at least consider it. No, we should just vomit out bad code at top speed. Good idea, guys. Idiots everywhere..

Comments
  • 2
    Tell me how would you loop an images pixels with one loop
  • 1
    @sharktits
    while (y <= image.height){
    // do something
    x++;
    if (x == image.width) {
    x=0; y++;
    }
    }

    This solution is as good and reasonable as this users rants which seem like the tiny rage of a student coming fresh from college demanding from everyone they do it his way (mixed with a little amount of real rage)
  • 1
    @sharktits well an 2D array is simply a 1D array in RAM. So just the access to a given pixel X, Y would be a bit trickier if you used an 1D array but you could iterate over it using a single for loop
  • 0
    I don't get the topic here.
    Ok, so somebody did some algo having O(n^2) complexity, fine, seeing it.
    Why do y'all suggest using only one loop for iterating through a 2D array?
    Time complexity stays the same, readability isn't really increased either.
  • 0
    If you use a single loop to iterate over a 2D array you still have the same complexity but now no one will understand your code
  • 0
    Oh, and fuck TSP
    I know, this is an old hat and got nothing to with this rant, but man, why can't NP just be P
Add Comment