Novels2Search
The Daily Lives of Ordinary High Schoolers
Chapter 5: Eric chats up Ilyssa, part 4

Chapter 5: Eric chats up Ilyssa, part 4

Teacher: Okay class, I want an algorithm that sorts an array of integers using the least possible number of writes.

Teacher leaves the room.

Eric: Oh I know this one! We can just use cyclesort! It's theoretically optimal in the number of writes.

Ilyssa: Cyclesort is optimal with respect to the number of writes to the original array, but not in the number of total writes if you count the writes to the loop counter.

Eric: Wtf? Of course you don't count the writes to the loop counter.

Ilyssa: The teacher asked for minimizing writes in general, not just writes to the original array.

Eric: You can pretty much assume that she meant writes to the array. Why on Earth would she ask for minimizing total writes. In real life you would have situations where the array is stored in a storage device where writes are expensive whereas the loop counter would be stored in RAM or register depending on what the compiler decides to do with it.

If you discover this tale on Amazon, be aware that it has been unlawfully taken from Royal Road. Please report it.

Ilyssa: You can't just make assumptions like that. Writes to the loop counter are also writes, and you have no idea where the loop counter is going to be stored.

Eric: No reasonable person would ever interpret her question as minimizing "the total number of writes including writes to the loop counter". That would be fucking retarded.

Ilyssa: You can't just make assumptions like that. If she doesn't specify which writes, it means total writes including writes to the loop counter.

Eric: Wtf, no it doesn't. No reasonable person would ever ask a question like that.

Ilyssa: Why would you ever assume that the asker is reasonable?

Eric: Okay you win. I'm going to ask her when she gets back.

Previous Chapter
Next Chapter