Okay, how long has it been since I have posted an entry on this blog? Two months? I forgot to check, and I can’t be arsed checking right now.

“So, what’s been going on with your C++ learning lately?” I hear nobody ask. Well, if I haven’t already mentioned in an earlier blog post, I have had quite a lot of trouble sorting arrays. I got incredibly angry last weekend as I kept trying to make an algorithm to sort one; I refused to look up an algorithm, mostly because I thought I would be able to sort it out myself if I fiddle with it enough. No, that pun was not intended. As is probably amazingly easy to guess, I failed to make my own algorithm. I can’t say I’m surprised. As such, I eventually caved and went on teh Intarwebz to search for clues as to how I should go about completing this undertaking. I found a plethora of different sorting algorithms: bubble sorting, quicksorting, radix sorting, insertion sorting et cetera. I eventually settled with quicksorting, because I found it to be relatively understandable, and also because it was the first algorithm, the only one before it being bubble sort, I understood.

Working with quicksort was surprisingly easy: I made a draft in a notebook with a sample array and worked out if the algorithm I had in my head would work. It would.

The hard part wasn’t really understanding quicksort. Rather, the hard part was actually implementing it using C++ syntax: Using iteration statements and conditional statements, it took me a day to make a simple design on a CodeBlocks project separate from my main project and another hour to implement it in a way to fit the project’s current design.

All in all, the quicksort seems to work pretty well. I should figure out how to make a function for it someday. I guess that involves learning myself to make passing by reference more of a habit and actually understanding what that means.