>coding exam >"implement insertion sort" >fail

FUUCK WHY IS PROGRAMMING SO HARD
I DONT EVEN KNOW INSERTION SORT, ISNT BUBBLE SORT GOOD ENOUGH????

Attached: 1kinni.jpg (600x596, 165K)

Other urls found in this thread:

youtube.com/watch?v=lAxUDaUMtOQ
youtu.be/K4CuPzdiAIo
youtube.com/watch?v=ROalU379l3U
twitter.com/SFWRedditVideos

You mean the easiest, most obvious sorting method that if you ask any 110 IQ normie how to sort a deck of cards algorithmically they will inevitably use?

FUCK YOU THATS EXACTLY WHAT THE TEACHER SAID WHEN I ASKED WHAT INSERTION SORT IS
I DONT PLAY CARDS I PLAY KEYBOARDS

how exactly is insertion sort different than bubble sort?

Come on user, it's even easier to implement than bogosort

It's time to put aside videogames op and grow up

Fuck you nothing else in live makes me happy

It's just fucking two nested loops where you find the correct spot to insert into, about 10 lines of code.
If you can't implement that in 10 minutes or less it's time to look for another career.

just .sort(), lol.

If you don't set priorities properly, you will never go far

Attached: OP_is_a_faggot.jpg (400x225, 7K)

let insert cmp l x =
let rec loop accu = function
| [] -> List.rev_append accu [ x; ]
| y :: ys ->
if cmp x y < 0 then
List.rev_append accu (x :: y :: ys)
else
loop (y :: accu) ys in
loop [] l
;;

let sort cmp l = List.fold_left (insert cmp) [] l;;

If you think you're unhappy now, just wait. You'll be REALLY unhappy in the near future unless you get over your addiction to short-term gratification as way of ignoring having to deal with life's problems.

Attached: 1521789977839.jpg (720x720, 103K)

Long-term gratifications is a meme. I might get a heart attack next sunday, what's the purpose??
I just want to work for a shitty office where managers launder money and leave programmers alone.

>I might get a heart attack next sunday,
so your big plan is to cower from life and hope you get a heart-attack? I don't understand.

>Long-term gratifications
the long-term is all there is. The short-term is already in the past. You'll be 40 before you know it.

Refusing to accept reality isn't a way of dealing with it, despite what you tell yourself.
youtube.com/watch?v=lAxUDaUMtOQ

Attached: sad-gattsu.png (1000x1016, 994K)

>cower
I'm not screwing myself over by spending a bit more effort than necessary. I live now, my consciousness knows only now. The problems of myself in X days are for another person to solve (in part myself-in-X-days).
>You'll be 40 before you know it
Wow I hope so, I'm tired of being surrounded by young people with heads in the clouds.

Bubble sort is when you swap neighboring elements that are out of order until the whole array is in order. Insertion sort is when you have a section that's already sorted, then insert elements into it one by one.

Bubble sort is slower because instead of putting a new element in the right place right away you basically only shift it over by one every iteration so it can take a long time to get it right.

>a bit more effort than necessary.
what are you talking about? Apparently how you're behaving is a lot less effort than is necessary to pass a basic test.

>I live now, my consciousness knows only now.
sure bud, you're above the law

>The problems of myself in X days are for another person to solve (in part myself-in-X-days).
yeah that's the point. You'll hate yourself then

>Wow I hope so, I'm tired of being surrounded by young people with heads in the clouds.
like you? normally people notice flaws they suffer from in others before they acknowledge they have flaws themselves.

Attached: Screen Shot 2018-04-20 at 11.45.58 PM.png (2880x1800, 2.33M)

lol i was building a heapsort today in Python and wrote a importable DLL module to increase the speed of the actual node comparison part, still can't even touch Python's timsort speed

>pass a basic test
It's gone, I'll take it again next year no problems.
>above the law
????
>You'll hate yourself then
I fucking wish I was a settled-down grumpy 40 year old who lived in the past. Right now life is nondeterministic and it's killing me that I'm not following the mathematically optimal path. So fuck it, Dijkstra already made an algorithm for this, just gotta follow the path of least effort every day to live a quiet life.
>like you?
My head isn't in the clouds, I have no hopes or dreams. I'm settled, just wake up every day and follow the schedule.

>I fucking wish I was a settled-down grumpy 40 year old who lived in the past.
you wont

>I'm settled, just wake up every day and follow the schedule.
you've confused nirvana with sleepwalking through life. stop lying to yourself. That's why you hate yourself and feel miserable, because you feel guilty over failing to live up to the expectations you truly have for yourself, despite your sophomoric denial that that's the case. And because you hate yourself, you take sick pleasure in seeing yourself fail. If you just grew up and did what you were supposed to, you'd feel better and probably sleep well for once. Do you fall asleep listening to music, tv, or radio?

Attached: tumblr_mul7xlcMja1s71q1zo1_1280.png (800x1058, 1.18M)

I don't fucking hate myself, I hate how any mathematically optimal way of life requires 48 or 72 hours a day. Time for three lives - one for my major, one for friends and family, and another for hobbies, fitness, etc.
I am not spending my time maneuvering and spreading my time about like a madman for little to no gains.
>sick pleasure in seeing yourself fail
Are you projecting at this point?
>supposed to
I physically cannot do what I'm supposed to because that requires more hours than there are in a day.
>Do you fall asleep
I just jerk off and snooze in 30 seconds to 2 minutes.

The path to least effort leads to you being homeless and dying on the street you retard.
Are you really so fragile that you flip out over failing an exam simply because you failed to pay attention or read when you went over sorting algorithms in one of the easiest programming courses you'll take?

>being homeless and dying on the street
oh boo hoo
>fragile
I'm literally trying my best to give a shit about this major, I really am. I was lied to that coding is a relatively simple job. Who cares about sorting algorithms, the best ones have already been invented, why would I ever re-learn them.
Somebody somewhere is learning useful shit instead of treading over the same path and making more progress than me.
Fuck this, it's almost 1AM and im going to bed.

>mathematically optimal way of life requires 48 or 72 hours a day.
excuses excuses. You're probably not very efficient at doing things, which is something you can train by the way.

>Time for three lives - one for my major, one for friends and family, and another for hobbies, fitness, etc.
yeah it's called priorities. that's life. yours are fucked and not in line with reality.

>Are you projecting at this point?
it's not projection, it's more common problem, especially among young men, then you think. When I realized that about myself I couldn't believe it. Definitely explained a lot of my past actions i couldn't understand why i did. I don't feel constantly guilty anymore, which made doing work and achieving things a lot faster when 6 out of every 10 thoughts I was having when trying to concentrate on a problem weren't about how I was such failure.

>that requires more hours than there are in a day.
you're just lazy. you could be done faster if you really tried and your cognitive abilities were at their full, undepressed potential.

>jerk off
yeah, habitual masturbation is another bad habit

Attached: please-god.gif (256x192, 109K)

Thanks boomer dad

>oh boo hoo
you say that now

>why would I ever re-learn them.
well #1 should be because they're interesting, #2 because you need to know what tools are at your disposal for solving problems. You're not reinventing the wheel, you're learning how it works so you can use it.

>train
Nooope
>priorities
Fuck priorities, I'm not becoming some basement dweller.
>really tried
God man I'm not even getting paid for this shit.
>bad habit
Yeah well I'm not wasting time and money with women for a simple sexual relief. Porn access is literally instant and free, and my penis knows no difference.
Okay bed time.

stale memes don't change the fact I'm right

>Fuck priorities
>I'm not even getting paid for this shit.
you're such a spoiled child

>Okay bed time.
just remember you'll have only yourself to blame

>insertion sort
Fuck I haven't heard that term since 12th cbse when I hated my cs teacher so much that it turned me off of cs shit for years until I realised I liked it and am good at it

Fuck you Bikram, fucking asshole

>WHY IS PROGRAMMING SO HARD
Hard? I actually find it fun, especially when a syntax error message pops up and I have to start using the (#) key to turn off sections of code to begin locating the problem (I'm still incredibly new at this).

>commenting out sections of code
>not putting annoying print statements after literally every piece of logic and every step of every loop

I have bad anxiety so I always fuck up live coding tests in front of people since I can't focus on the problem properly but if you can't do this without the pressure of someone watching then yeah you might want a different career.

NOOO it's so slow at O(n**2) thats a time complexity of 400ms for a 20 item list thats Soooo SLOOOWWW

You seem like the right kind of person to ask. There was a screencap of a speech from an anime, it looked like it was from kaiji ultimate survivor but I don't recall the scene. It was talking about how people live their entire lives saying that "oh I'll start tomorrow" but tomorrow never comes and they die realizing that the life they lived is the real thing and they wasted it. You wouldn't happen to have it would you?

radix is probably the coolest sort just learn that

>ISNT BUBBLE SORT GOOD ENOUGH????

They're okay, but if you know enough about programming to know about bubble sort, you know enough to know you can do better.

Normies when asked to sort cards do so by laying them all out into suits then recombining; this is counting sort, which is a linear speed sorting algorithm.

This incidentally means if you thought it should be done another way, normies have bested you again. This is fitting and proper.

Like piano keyboards?

Insertion sort: Left side of your array is the sorted numbers, right side is the unsorted numbers, pick up the next unsorted number and insert it into your sorted array in the correct position, shifting everything else down to put it there. Repeat this till there are no unsorted numbers left.

Bubble sort: From start of the array to the end, look at two adjacent numbers. If they're not sorted, sort them and keep going. Keep doing the above until you've gone through the array once without performing a single swap.

Same problem for both though: come back in an hour or maybe never if your problem size is big.

We don't know if he plays videogames, just keyboards.

I hope you find happiness, user.

Don't hate on beginners, you were one too.

This is the correct answer 95% of the time, if I see a code review where someone implemented their own sort, no fucking way we're merging it.

This

>be me
>be datastructs class
>get choice between implementing hash table or tree
>do tree because everyone said it's harder
>prof: ok anons, for the second part of this course, you have to implement one of the following sorting algorithms. except for you user, because your structure is self sorting.

I have a degree but I never implemented bubblesort, or insertion sort. I'm not even sure how they work. I assume that quicksort will solve all my problems if I were to ever have any that .sort(a,b -> a-b) won't solve.

Attached: lobstering.gif (960x540, 1.33M)

WAS DU HEUTE KANNST BESORGEN DAS VERSCHIEBE NICHT AUF MORGEN

old nazi adage. not politically correct, and deeply ableist.

>not knowing what insertion sort is
You actually could try to deduce from the name what it means, and probably be right. You just insert values into the correct places of the sorted fragment of your list.

Thanks for explaining the difference between insertion and bubble sort.

>I was lied to that coding is a relatively simple job
That happens a lot when you're stupid.
Why do you think it pays so much if it's a simple job? All of the simple jobs have been automated, unless you're willing to work for less than a machine.

The job itself is simple, it's just really easy to end up in situation where you're way the fuck out of your league in terms of needed knowledge to do something.

Brainlet, both bubble sort and insertion sort are O(n^2) average and worst
Even quicksort is overrated and is actually still O(n^2) in worst case (the only case that matters)
Merge sort or GTFO

>The job is simple, except the parts of the job that are not
Such wisdom.

but why is it called quicksort then, goy?

>not using introsort
enjoy your O(n) space use

>worst case (the only case that matters)

Attached: 0cbpdjii3pa11.png (645x729, 105K)

All of this is fine and dandy until the recruiter asks you to describe heapsort in detail.

>I have a degree but I never implemented bubblesort, or insertion sort.
The absolute state of college.

Here you go, OP; this channel helped me study for my algorithms course.
This method of teaching is awesome, imo.
This particular video is about insertion sort, but check out the rest of the videos on this channel; they've got ones for other sorting algorithms and other algorithms in general.
youtu.be/K4CuPzdiAIo

superior learning method coming through
youtube.com/watch?v=ROalU379l3U

>Insertion sort
>Bubble sort
>Hard
>Basic fucking algorithms that is shown briefly by most books because of the simplicity
The absolute state of Jow Forums

I'm at third year in compSci, I don't even know how insertion sort works, lol

Attached: 1536604513635.gif (640x480, 1.26M)

and thats a GOOD thing

> not using sleep sort

>the fact I'm right
But you're not right.

>worst case (the only case that matters)
"no"

Worst case is more important than most people think, true, that's why Linux uses a heapsort variant instead of quicksort. Not to mention that, unlike quicksort, it's truly in-place, while quicksort uses the stack (despite this, most textbooks call quicksort an in-place sort, but anyway).
Having a better worst-case complexity also guarantees that you don't run the risk of having an expensive degenerate case, which is crucial for hard real time applications.

Memorizing the implimentation of algoriths does literally nothing for you
Besides, for any given language and problem there already exists an optimal implementation of the vast majority of commonly used algorithms.

Understanding how to into good algorithmic design helps you.
Knowing the usecases for solved algorithms helps you.
Memorizing things will never help you, no matter what it is.
Memorizing isn't learning and doesn't make you smarter.
Unfortunately memorizing is easier to quantify and all education systems even non-profit publicly funded ones rely on showing results to get funding.

i don't know either lmfao, graduated top of my class cuz our education system isn't fucked like in the US of A
who the fuck in the entire world asks anyone to sort a deck of cards, nevermind algorithmic-ally? what kind of autism is this
the fuck kinda language is this? :::script? lmfao
nobody does, i barely even remember how bubble sort works, doesn't stop me from being a backend software engineer though lol

You can implement insertion sort in 3 lines

>Incoherent babbling
>Uses Zoomer nigger slang like lmfao
Wanna know how I know you're LARPing? Faggot.

Selection sorts are more intuitive from an algorithmic point of view and do less swaps anyway.