Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "quicksort"
Just started learning haskell and if someone wants a 'why' I give you quicksort:
quicksort  = 
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
lesser = filter (< p) xs
greater = filter (>= p) xs12
University Final Viva for OOP with C++
(Yeah, that first line is a rant in itself for the likes of me and Mr. Torvalds)
Tell me a few "functions" in C++ STL algorithm header
*starts off with the first one that came to my mind*
AP: Huh? a I'm asking the Algorithms in C++ STL
Me: Yes, this is one of them Ma'am.
She looked at me as if I told her that I'm dating her daughter. It became clear she doesn't know about it and she'll gladly deduct my marks for getting it wrong. So I explained how Sort() is a hybrid of quicksort, heap sort and insertion sort. (Read about it an hour ago while doing a competitive programming question)
AP: Tell me the ones we did in class.
I haven't attended those classes, so I just told her the ones I knew.
After a couple more infuriating questions, which themselves sounded right from a book published in the 90's, she gave me 10/15.
This is what's wrong with India's Education system, even the teachers know only the stuff mentioned in the course hand-outs. Forget brownie points, you get screwed over by the teachers for actually knowing stuff and using it.8
Yesterday was the first day of my final exams. (They are scheduled this whole week) First exam was programming on paper and it went surprisingly good. I'm pretty sure i made one or two minor mistakes but overall it should work. (3 tasks: program a calculator; program a car-showcase program and explain quicksort) We had 3 hours to do this and even though i needed them i didn't feel any pressure. That was really nice. Thank you for calming me down the last days/weeks and ensuring me that i can do this.
I hope today's going as smooth. Exam of the day is networks. Wish me luck^^8
If some of you still have problems understanding Quick sort, I've got you covered. This is masterpiece.
This story just left me speechless in any way and i want to share it. tl;dr at the end.
Im studying computer science in germany and in the first of the small classes i noticed... no, i was disturbed by a guy who would just say that the thing we're learning atm were so easy and the teacher shouldn't even bother to explain it to the class. I don't understand why you would spoile a class that hard... I'm here to learn and listen to the teacher, not to you little asshole. (We were doing basic stuff like binary system etc. but still, let us learn)
So he became unpopular pretty fast.
Fast forward, a few weeks of studying later there was a coding competition where you had to solve different algorithmic problems in a team as fast as possible.
I came there, without a team because my friends aren't interested but I enjoy such tournaments. This guy and me were the only ones without a team and we had to work together.
After him being a total dick for hours i had to watch him code a simple for-loop, that iterates through a sorted array. Nothing special, at this point anyone could do that task in our class so it shouldn't be a problem for him.
He made a simple for-loop and it worked fine, but we figured we had to iterate through the array the other way around.
'Alright', I think. 'Just let the index decr..' 'Pssshhh', he interrupted me and said he knows exactly how to do this.
I was quite impressed when he started to type in 'public int backsort..' in a new line. He tried to resort the array backwards with a quicksort that he then struggled to implement. (Of course we had to implement a quick runtime and we needed that quicksort badly)
I was kind of annoyed but impressed at the same time. I mumbled 'Java has an internal sorting algorithm already' just to amuse myself.
He then used that implementation.
After a few minutes of my pleasure and multiple tests without hitting the requested runtime, i tried to explain to him why we wouldn't need to sort that array backwards and he just couldn't believe it.
I hope that he stays more humble after that..
Also we became last place but thats ok :)
tl;dr: Guy spoiles whole class, brags with his untouchable knowledge (when we do things like binary system). In a competition has to iterate through a sorted array backwards - tries to implement a sorting algorithm to sort it backwards first. I tell him, we could use a already implemented java method. Then tell him we could simply iterate through decreasing the index. Mind-Blown2
This is the most crazy, ugly, beautiful, stupid, and genius thing I’ve seen all year:
"Some time ago I wanted to rewrite my old project. I saw code without comments and cried. Cried so much."
Programming teacher in college
People who teach us programming usually write a quicksort every year for 5-10 years. It is sad af :(