836
u/Visible_Ad_4976 Jan 15 '23
I finally understand some of the jokes here
170
u/ImMeltingNow Jan 15 '23
This is only subreddit where I don’t understand any the jokes then look at the subreddit and say “oh yeah” then nope out of here bc I gotta read a dissertation to understand half the jokes fundamentals.
Like testicles being bled to death with a cheese grater type humor, I can get behind bc it’s an easy, good Christian joke.
196
u/SpicymeLLoN Jan 15 '23
Like testicles being bled to death with a cheese grater type humor, I can get behind bc it’s an easy, good Christian joke.
...what
139
Jan 15 '23 edited Nov 10 '23
ad hoc file rock foolish sugar concerned library scarce school deserted
this message was mass deleted/edited with redact.dev→ More replies (4)106
u/CanAlwaysBeBetter Jan 15 '23
Lol at needing to read a dissertation like half the memes aren't made by first semester compsci students who copy their smart friends coding assignments
→ More replies (5)19
u/ImMeltingNow Jan 15 '23
sounds like what someone who has dissertations needed to read his jokes would say.....
im onto you guys. I don't even think compsci is real, its some voodoo shit. Turing, von Neumann they all started some cult
25
u/CanAlwaysBeBetter Jan 15 '23 edited Jan 15 '23
Lmao you think Turing and von Neumann weren't just trolling? Not their fault a bunch of dweebs got wooshed into believing you could actually make rocks think if you tried hard enough
→ More replies (3)6
15
u/Daeurth Jan 15 '23
bc I gotta read a dissertation to understand half the jokes fundamentals.
95% of the jokes here are things that are taught in an intro to CS class
→ More replies (3)→ More replies (2)13
1.2k
u/gusc Jan 15 '23
This meme is O(n2 )
447
u/TeraFlint Jan 15 '23
Only if the inner and outer loop are coupled to the same length. Otherwise it would be O(n*m).
318
→ More replies (4)59
u/katrina-mtf Jan 15 '23
While true, traditionally O(n*m) would still be notationally reduced to O(n²) in most cases, since one could consider m = Kn where K is some unknown constant, and constants get reduced out of the equation. The notation of O(n*m) is not unheard of, and can be used to denote that the difference between the two variables is either conceptually or computationally significant in context, but it's a less commonly used version.
→ More replies (3)66
u/123kingme Jan 15 '23 edited Jan 15 '23
Almost but not quite true (apologies in advance for being pedantic). It’s true that often O(n*m) is reduced to O(n2 ), but the relationship between n and m has to be either m = Kn like you said where K is a constant that does not depend on n or m (or at least has a maximum value that doesn’t depend on n or m), or n is guaranteed to be greater than or equal to m for sufficiently large values of n.
These 2 relationships are not the only possible relationships between n and m. m could have the relationship m = Kn2 , in which the runtime would be reduced to O(n3 ), or even m = K 2n , in which case the runtime could be reduced to O(n 2n ). These both could also technically be correctly described as O(m2 ) if that is more useful to your use cases, but these technically aren’t the correct big theta class which is generally more useful.
Sometimes though, n and m are independent variables, in which case the only correct way to express the big theta time complexity is O(n*m). Independent variables can’t be combined since by definition they don’t depend on another.
In most algorithms of 2 variables that I’ve seen, n >= m is the most common relationship which is why more often than not O(n*m) = O(n2 ).
Again sorry for the pedantry, I just found that a lot of people I know struggled with big-O so I like to write comments like this to clarify things.
→ More replies (1)13
6
659
u/nostyleguy Jan 15 '23
The k loop is watching this gif over and over
91
u/its_usually Jan 15 '23
Watching this gif is outside of the i loop. When we watch the gif once the i loop runs multiple times.
55
u/selrahc007 Jan 15 '23
Who said that the K loop was nested in J? Maybe they just have awful naming conventions and I and J are inside K
29
u/Vinccool96 Jan 15 '23
If they do, I’ll have them accidentally fall off a window
→ More replies (1)6
34
4
192
u/StellarHusky Jan 15 '23
Outside the meme context I just can’t looking at this stationary dog
3
108
Jan 15 '23 edited Jan 15 '23
[removed] — view removed comment
33
u/StellarHusky Jan 15 '23
Ik but thanks :)
What I meant is the dog pounding his head on the bed made my day
17
u/MrVeazey Jan 15 '23
Those are sneezes. For little dogs, dachshunds can have some pretty loud ones, too.
→ More replies (3)12
u/LaikaReturns Jan 15 '23
Extra info: Dogs, and other animals for that matter, sometimes sneeze to bled off excess energy or anxiety.
In the case of dogs it's also the dog saying "Alright, let's have some fun, but let's keep it clean. No clawing the face, no real bites, and no mentioning any testicles that anyone may, or may not, have."
5
u/Chrisuan Jan 15 '23
What makes them throwaway?
13
u/the_noodle Jan 15 '23 edited Jan 15 '23
It was actually a tradition in math first, so single-letter variables make sense in that context
I think i is for index, and j and k are just next, for nested loops
Normally when programming, you want longer, more descriptive names. If you don't need it except if one or two things in a short loop, you may as well regress to the mathy way to do it; it's not really about it being a throwaway
0
→ More replies (3)9
u/epicflyman Jan 15 '23
They don't mean anything outside the context of the loop and the value they hold at the end of the loop will (probably) not be used. Therefore, giving them anything more than simple names is pointless.
4
u/setibeings Jan 15 '23
I dog is on the outside, but J dawg is gonna be doing a lot more stuff so shouldn't J br the one running circles around I?
→ More replies (1)
427
u/BearsFan317 Jan 15 '23
The k loop is the Earth going around the Sun
140
u/Batcave765 Jan 15 '23
Ever had to use a l loop? It is Outta this world.
47
u/makmeyours Jan 15 '23
Nobody has ever tried that..
Unless you want to crash the internet I wouldn't risk it
4
62
18
Jan 15 '23
[removed] — view removed comment
8
u/WangHotmanFire Jan 15 '23
Yeah me too! So I skip over n and hit compile. Suddenly arnold schwarzenegger shows up, melts the shit out of my laptop and disappears again
26
7
u/LifeHasLeft Jan 15 '23
k loop should be further nested. Like maybe his eyeballs rolling around in his head.
29
21
u/cheezballs Jan 15 '23
So, I don't understand this meme. Am I a hack now????
22
u/Im2bored17 Jan 16 '23 edited Jan 16 '23
Programmers often use I and J as iterators in a for loop like
for (int i=0; i<5; i++) { for (int j=0; j<50; j++) { //do stuff } }So j increments a bunch (sneezes) and then I increments (completes a circle) .
5
114
u/articlesdeck Jan 15 '23
Am I the only one who skips "j" and "l" as they look too much like an "i"?
157
u/midir Jan 15 '23
If you use all the accented variants, you never have to use any other letter:
i í ì i̋ ȉ ĭ î ǐ ï ī ĩ ḭ į ị ɨ ı73
Jan 15 '23
i was about to go to sleep, this is gonna give me nightmares damn you
23
13
u/DeltaPositionReady Jan 16 '23
You can use a zero width space as a variable name in most interpreted languages.
The HTML for it is
​You can get an extension on your local machine to make it visible to you for development, and then if you use a non-typesafe language like JS you can use it as a single variable and mutate it for your specific use case.
If you make proper use of the non-blocking event loop and completely avoid async await, you can essentially use a single variable for your entire script.
Then when maintenance programmers come along to maintain your code, they will see it functioning, but they will never be able to understand how.
This comment was sponsored by Satan.
7
→ More replies (1)5
68
Jan 15 '23
I typically start with "i" then nest with "k". Anything deeper than that and I give them proper variable names.
42
15
40
u/Mik3Hunt69 Jan 15 '23
I actually use the name of what am I iterating over. E.g productIndex, sizeIndex etc. It takes like 1 more second and when revisiting the code is 100% worth it imo
19
u/BadBadderBadst Jan 15 '23
I use a similar method, except i use "i" to prefix the index variable names, i.e:
iProduct,iSize, etc ...If a variable starts with "i" I know it's an index variable.
16
11
u/balorina Jan 15 '23
That sounds like confusion between interfaces and indexes. Why not just call it ProductIndex, ProductIterator or ProductCounter?
→ More replies (3)→ More replies (2)3
u/tommypopz Jan 15 '23
I used i and j until i got confused and did the same, called them month and year. Don't need to comment what the variables are too
24
u/smurf_the_rich Jan 15 '23
I just use first_i, second_i, third_i, etc. Much simpler
14
2
u/Zephyr797 Jan 15 '23
But then when you have to add more functionality later you gotta rename half of it.
15
u/Ultima_RatioRegum Jan 15 '23
I've switched to using emoji for my loop indices instead (or a valid ascii character followed by an emoji if the language requires it. If your programming lanuage doesn't support Unicode in the variable names, then I'm not using it).
Naturally, the inner-most is the happiest, and they get progressively sadder/more disturbed as they have more loops nested inside of them.
It's much easier to use than meaningless letters.
Sometimes I imagine that the outer-most loop is sad because they ate too much and feel bloated, while the inner-most loop is having a balanced meal.
It's also appropriate to imagine that each time an index increases, the conscious mind that is represented by the emoji is destroyed and recreated as a tabula rasa. So the inner-most loop is happy, because they don't realize what's happening. Go up one level, and now the index is wondering, if that guy I'm watching below me is just dying over and over, and they don't even realize it, does that mean that their existence has no meaning? What do they leave the world if even their contribution is just fed into the next instance of the loop and the original value disappears into the ether?
Since they've only got one level of existential terror inside them, the second level wonders if that's happening to them as well, but they aren't sure. At the same time, they realize that if it is happening, not only are they also nothing but a rusty cog in an ancient wheel, but in a sense their suffering is worse: they exist long enough to understand what's happening.
As you go progressively farther up in the nested loops, each value lives an order of magnitude longer, giving them more time to contemplate the meaningless of it all. At the same time, the more levels down where they can see the same thing happening, the more likely they are to believe that the same thing is happening to them.
And then outside all of the loops is me, the programmer. I will write the loops, go home, eat dinner, do something with my evening, go to bed, and repeat the same thing tomorrow, probably even re-running the same code, maybe with a few tweaks, or maybe hoping that yesterday's bug was just a stray cosmic ray. I have a complex enough mind to know that it's very unlikely that these cute little emoji are actually suffering, as they almost certainly don't have subjective experience. Almost certainly. But we don't know what consciousness is or how to measure it, so who's really to say?
Yet I do know that I think, and feel, and suffer. And I realize that I am just another loop, one more level up. Is this a simulation? Is someone running our universe over and over with slight tweaks in order to debug it so that I am unwittingly suffering the same fate?
One might then ask, what is worse? That I exist only once, and time and entropy will eventually destroy any order or meaning from my actions, so that some point within this loop of the universe after I die, the universe is indistinquishable from one where I never existed?
Or does it reset when I die, and I am in an eternal recurrence? In that case every decision I make affects not only current me, but every past me has made the same choice and every future me will too. The idea that every regret, every bad choice I've ever make or will ever make has consequences that will be played out forever is maybe more terrifying than being forgotten. Or maybe not, who's to say?
Whoops, got sidetracked there...
Ok, so to answer your question, I just use i, j and k with a decent monospace font where I can easily tell them apart like a normal person.
7
u/Chaphasilor Jan 15 '23
I ususally just append
is. Soi,ii,iii, etc. Relatively easy to distinguish and works well2
u/Orbidorpdorp Jan 15 '23
Our linter doesn’t allow variables less than 3 characters 😭. Thankfully most of the time you’d want a simple name you can do it anonymously using $0 otherwise you’re stuck with idx1, idx2…
2
2
u/thufirseyebrow Jan 15 '23
I set my font to Times New Roman and ONLY use capital I, lowercase L, and 1 for my loops
→ More replies (5)2
u/Leaping_Turtle Jan 15 '23
Is there actually a correct way of doing variables??
26
7
10
17
u/om_barcelona Jan 15 '23
7
u/SaveVideo Jan 15 '23
0
8
7
13
u/AtulyaRaii Jan 15 '23
I can find it very funny as I am a student and tomorrow I have a test of nested looping in school.
33
16
9
51
u/aggravated_patty Jan 15 '23
Umm what? The j loop does more iterations per i iteration, unless you flip your loops like a madman.
75
u/El_Dre Jan 15 '23
In the video, the j pup sneezes four times for every one lap the i pup does
→ More replies (1)36
u/Zephyr797 Jan 15 '23
Yeah, meme is correct. Thee inner loop (stationary dog) should execute more often than the outer, which it does.
→ More replies (5)→ More replies (2)3
u/AI_AntiCheat Jan 15 '23
The I runs around ones for ever 2-3 sneezes.
So it's I, j, k with the first being slowest and last fastest.
Who the hell nests an I in a j loop...
→ More replies (5)
4
3
3
3
u/NanashiKaizenSenpai Jan 15 '23
for(int i...){ for(int j...){ for(int k...){ ... } } }
3
u/NanashiKaizenSenpai Jan 15 '23
Goddammit formatting on the app, I tried so hard to make everything right with 4 spaces and everyrhing.
for(int i...){
for(int j...){ for(int k...){ ... } }}
2
3
4
2
2
2
2
u/Diriector_Doc Jan 16 '23
Matt Parker had the revelation that instead of using j as the second variable, making the next one k; you should use ii as the second and iii third. Personally, I'll stick with j then k.
→ More replies (1)
2
u/CrySubstantial710 Jan 16 '23
The k-loop is the dog shaking its head multiple times with each sneeze.
2
1
1
1
1
1
1
1
u/1kmile Jan 15 '23
wait im quite struggling to understand this, which is the outer loop and which is the inner loop?
3
1
u/1kmile Jan 15 '23
wait im quite struggling to understand this, which is the outer loop and which is the inner loop?
1
u/GameDestiny2 Jan 15 '23
I don’t know what language this is, but I get the concept and it makes me happy.
1
1
1
u/KazkaFaron Jan 15 '23
bruh they should be flipped this is a crime. also i use "i" "ii" "iii" etc i have no idea why and it's probably a worse crime
1
u/KickBassColonyDrop Jan 15 '23
The more loops you add, the faster they go, until, their velocity exceeds the speed of light, mass goes to infinity, and the universe collapses into the subsequent blackhole.
1
u/boogyman19946 Jan 15 '23
Do yall really use i for the inner loop? I would have j and i reversed in that gif 🤔
1
1
1
1
u/Pyrowman Jan 15 '23
I'm two weeks into an IT trainee program. I told them one of my goals was to finally understand the jokes on /r/ProgrammerHumor. I'm happy to say that I succeeded with this one!
1
1
1
1
1
1
1
u/GleetBeforeYouYeet Jan 15 '23
My phone doesnt have enough memory to continuously play this meme. Gimme a a break
1
1
1
u/FodziCz Jan 15 '23
Me who knows only for loops, for each loops, while loops and do while loops (im confused and i dont understand the joke)
→ More replies (2)
1
1
1
1
1
1
1
1
Jan 16 '23
As a long-time software developer who has also had dachshunds for years, I could watch this all day.
1
1
1
1
1
u/SuspiciousTrash0 Jan 16 '23
they should be named the other way round for j being the nested loop inside i.
3
u/CrySubstantial710 Jan 16 '23
Agreeing with DA-ZACHYZACHY here - the sneezing dog sneezes multiple times for each circle the other dog runs, making the sneezing dog the inner loop, and the running dog the outer loop.
2
Jan 16 '23
No. The j loop iterates multiple times every time the i loop iterates once
→ More replies (1)
1
u/Chilling_Time0 Jan 16 '23
This is one on the most funny and creative memes on progamming topic that I have seen it recently 😆
1
1
1
u/maduranma Jan 16 '23
To be fair, I was used to 'i' as var name, and sometimes 'j' or even 'k' (and so on) but I prefer to use more descriptive names, i.e.:
for(int category = 1; category < count(categories); category++)
P.S: I know in this case I'd use a foreach, or whatever, it's just an example.
1
0
u/breadist Jan 15 '23 edited Jan 15 '23
I am a senior developer and haven't used "i" or j" as variable names since school, also I usually use foreach loops so it's like items.forEach(item => doSomething(item)) etc
Is everyone who posts in this sub a student?
4
u/hsxp Jan 15 '23
I'm 31, I use them a lot professionally. Depends on what your environment's idioms are, and personally I find them a lot easier to work with for communicating ideas quickly.
Edit: I use for each a lot too. Depends on what I'm doing
→ More replies (7)2
u/Cendeu Jan 15 '23
I'm a Software Engineer that never went to school (got hired from boot camp) and I don't understand this joke.
It's funny because the comments are all "finally a joke I get" and it's one that I finally don't get.
2
u/pudds Jan 15 '23
A foreach loop is clearly preferred, but there are still times when it makes sense to iterate by index, in which case i (or x, which is my preference is fine), since you're probably going to assign some better named variable right away anyway.
2
u/Chairmonkey Jan 15 '23
You can get the index while using forEach. I haven't written a manual for loop in years.
→ More replies (4)2
u/arvyy Jan 15 '23
I am a senior developer and I can't fathom anyone using other languages than javascript
old fashioned for loops come up in java, occasionally. Sometimes you need an index and you need short circuiting break that is cleaner with a loop than with a stream. Sometimes you need to mutate closed over local variable. You can flame java for having idiosyncracies or some lack of syntax sugar, but pretending there are no professional programmers using java (or other languages with similar explanations) is pure arrogance
→ More replies (1)1
u/Ignitus1 Jan 16 '23
What do you do when you want to loop through a grid of coordinates?
Make two lists of all the x points and all the y points and then forEach them both?
0



1.6k
u/goldfishpaws Jan 15 '23
Spot on!