400
you are viewing a single comment's thread
view the rest of the comments
[-] victorz@lemmy.world 49 points 1 week ago* (last edited 1 week ago)

How in the hell does anyone fโ€” up so bad they get O(n!ยฒ)? ๐Ÿคฏ That's an insanely quickly-growing graph.

Curious what the purpose of that algorithm would have been. ๐Ÿ˜…

[-] petersr@lemmy.world 23 points 1 week ago

Let me take a stab at it:

Problem: Given two list of length n, find what elements the two list have in common. (we assume that there are not duplicates within a single list)

Naive solution: For each element in the first list, check if it appears in the second.

Bogo solution: For each permutation of the first list and for each permutation of the second list, check if the first item in each list is the same. If so, report in the output (and make sure to only report it once).

[-] victorz@lemmy.world 2 points 1 week ago

lol, you'd really have to go out of your way in this scenario. First implement a way to get every single permutation of a list, then to ahead with the asinine solution. ๐Ÿ˜† But yes, nice one! Your imagination is impressive.

load more comments (18 replies)
this post was submitted on 22 Jun 2024
400 points (97.4% liked)

Programmer Humor

18253 readers
1664 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS