4 ms·
How can you mess up quicksort? Pick a pivot, lower values on one side, higher values on the other. And recursively rinse and repeat.
by UK-AL 13y ago
How can you mess up quicksort? Pick a pivot, lower values on one side, higher values on the other. And recursively rinse and repeat.
- TheAceOfHearts 13y agoI get really nervous and I make stupid mistakes. Every single time I've had an interview and I'm asked to code I end up making stupid mistakes because I try to answer too quickly or because I don't sit down to properly think about the problem. It's definitely something I need to work on. Thankfully I got an internship that let me do a small project to demo my skills, instead of hazing me. And after my internship they were so happy that they offered me a full time job.
- zanny 13y agoI once messed up a string size parser in an interview by going len instead of len - 1 in measuring the number of characters displayed. It is stress. Introverts like myself I imagine collectively are horrible under intense pressure from random strangers who can dictate your future for months or years.
- T-hawk 13y agoQuicksort is amazingly easy to screw up. There's a lot of opportunity for off-by-one errors in all the index manipulation. I coded quicksort as an interview practice exercise in plain C a few years ago and it took quite a number of iterations until getting it all correct.