7

Fuck this algorithms course. How the fuck do you expect me to populate a 2d array of N^2 elements with data in linear time if you won't fucking let me write to more than one element at a time???

Dear CS department,
Make sure your homework makes fucking sense before shipping it off to students.
Regards,
A pissed off student

And before anyone comes at me with this "But you can technically do that if there's k*N elements and it would still be linear time" shit, fuck off; there's a worst case of needing to write to half the elements in the 2d array so it's still N^2 no matter how you try to "but technically" your way though it.

Comments
  • 0
    A 2D array in linear time?
    This JS script should fit the requirements:

    @highlight
    const n = 10;
    const innerArray = [...Array(n).keys()];
    let elementArray = Array(n).fill(new Array());
    for (let i = 0; i < n; i++) {
    elementArray[i].push(innerArray);
    }
  • 0
  • 1
    @bioDan he told us to think of it as a NxN matrix instead of an array of arrays. I'm not really sure why or what the difference would be when the representation in code would be an array of arrays or an array of NxN length. He wants everything in pseudocode and modifying full rows/columns at a time isn't allowed, single elements only.

    I did have the solution where I wrote full rows at a time, but he wanted us to treat writing N elements as taking O(N) time, yielding overall O(N^2). I basically just gave up and wrote that the problem is bullshit without writing up to N elements concurrently
Add Comment