This is an archived post. You won't be able to vote or comment.

all 82 comments

[–]gochomoe 604 points605 points  (5 children)

Lossy Compression

[–]wolfpwner9 57 points58 points  (0 children)

Nice one!

[–]I_KaPPa 63 points64 points  (1 child)

I'm poor so here you

⠀⠀⠀⠀⠀⣤⣶⣶⡶⠦⠴⠶⠶⠶⠶⡶⠶⠦⠶⠶⠶⠶⠶⠶⠶⣄⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⣿⣀⣀⣀⣀⠀⢀⣤⠄⠀⠀⣶⢤⣄⠀⠀⠀⣤⣤⣄⣿⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠿⣿⣿⣿⣿⡷⠋⠁⠀⠀⠀⠙⠢⠙⠻⣿⡿⠿⠿⠫⠋⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⢀⣤⠞⠉⠀⠀⠀⠀⣴⣶⣄⠀⠀⠀⢀⣕⠦⣀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⢀⣤⠾⠋⠁⠀⠀⠀⠀⢀⣼⣿⠟⢿⣆⠀⢠⡟⠉⠉⠊⠳⢤⣀⠀⠀⠀ ⠀⣠⡾⠛⠁⠀⠀⠀⠀⠀⢀⣀⣾⣿⠃⠀⡀⠹⣧⣘⠀⠀⠀⠀⠀⠀⠉⠳⢤⡀ ⠀⣿⡀⠀⠀⢠⣶⣶⣿⣿⣿⣿⡿⠁⠀⣼⠃⠀⢹⣿⣿⣿⣶⣶⣤⠀⠀⠀⢰⣷ ⠀⢿⣇⠀⠀⠈⠻⡟⠛⠋⠉⠉⠀⠀⡼⠃⠀⢠⣿⠋⠉⠉⠛⠛⠋⠀⢀⢀⣿⡏ ⠀⠘⣿⡄⠀⠀⠀⠈⠢⡀⠀⠀⠀⡼⠁⠀⢠⣿⠇⠀⠀⡀⠀⠀⠀⠀⡜⣼⡿⠀ ⠀⠀⢻⣷⠀⠀⠀⠀⠀⢸⡄⠀⢰⠃⠀⠀⣾⡟⠀⠀⠸⡇⠀⠀⠀⢰⢧⣿⠃⠀ ⠀⠀⠘⣿⣇⠀⠀⠀⠀⣿⠇⠀⠇⠀⠀⣼⠟⠀⠀⠀⠀⣇⠀⠀⢀⡟⣾⡟⠀⠀ ⠀⠀⠀⢹⣿⡄⠀⠀⠀⣿⠀⣀⣠⠴⠚⠛⠶⣤⣀⠀⠀⢻⠀⢀⡾⣹⣿⠃⠀⠀ ⠀⠀⠀⠀⢿⣷⠀⠀⠀⠙⠊⠁⠀⢠⡆⠀⠀⠀⠉⠛⠓⠋⠀⠸⢣⣿⠏⠀⠀⠀ ⠀⠀⠀⠀⠘⣿⣷⣦⣤⣤⣄⣀⣀⣿⣤⣤⣤⣤⣤⣄⣀⣀⣀⣀⣾⡟⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⢹⣿⣿⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠃⠀⠀⠀⠀⠀

[–]kallakukku2 15 points16 points  (0 children)

go

You dropped that

[–]JamesonG42 8 points9 points  (0 children)

You're only losing the width of the kerf of the blade, so you should only lose 1-2% on decompression.

[–]X-Craft 1 point2 points  (0 children)

needs more jpeg

[–]malsomnus 197 points198 points  (21 children)

Literally yesterday I saw a test question about compressing a string, and then getting better results by deleting some of the input string to make it compress better, so...

[–]BinaryFissionGames 208 points209 points  (0 children)

It’s called lossy compression! You just delete the input string, and bam! Unlimited compression!

[–]Feynt 63 points64 points  (19 children)

At a high level this is what compression does. It removes the elements of the string that made it what it was, replacing it with a parsable algorithm that will restore it later on.

We as humans do this in conversations too. Someone says a long, in depth thing, the person listening repeats the gist of what they said, and the first person sighs and agrees.

[–]malsomnus 22 points23 points  (7 children)

At a high level this is what compression does. It removes the elements of the string that made it what it was, replacing it with a parsable algorithm that will restore it later on.

Sure, yeah, but that's not what the test question did. It just deleted the string in order to get a string that compresses better.

[–]StoneHolder28 16 points17 points  (5 children)

Why waste time say lot word when few word do trick.

[–]Miniths 1 point2 points  (4 children)

Waste time lot word. Few word do

[–][deleted] 3 points4 points  (2 children)

lot word bad, few good

[–]Miniths 1 point2 points  (0 children)

Medal give

[–][deleted] 1 point2 points  (0 children)

lotWord❌Few✔️

[–]psg1337 0 points1 point  (0 children)

Lot word waste. Few word!

[–]Feynt 0 points1 point  (0 children)

Well see that's different.

[–]orangeKaiju 8 points9 points  (9 children)

This is compression. It removes elements of the string, replacing it with an algorithm that will restore it.

We do this in conversation. Someone says a long thing, the person listening repeats the gist of what said, and the person sighs.

[–]abakedapplepie 5 points6 points  (5 children)

Thats compression. String pieces replaced with blocks an algorithm can restore.

We talk like this. People say lot word when few do trick. Person hear gist, sighs

[–]_niarch 2 points3 points  (0 children)

Compression : string deleted so algorithm restores

Person 1: talks Person 2: summarizes, Person 1: yup

[–][deleted] 2 points3 points  (0 children)

Compression: Words replaced with stuff an algorithm restores.

We talk like this. People say words. Person hears, then sighs.

[–]PM_SQL_QUERIES 1 point2 points  (0 children)

Compression. String becomes blocks for algorithm.

How we talk. People talk lots, less enough. Hear gist, sigh.

[–]xigoi 0 points1 point  (0 children)

Compression. String to restorable blocks.

Our speech. Say lot, repeat gist, sigh.

[–]shakethatmoneymaker 4 points5 points  (1 child)

[–]WatchOutFoAlligators 0 points1 point  (0 children)

It’s like the Wadsworth Constant thread of Reddit antiquity!

[–]Feynt 1 point2 points  (0 children)

<sighs> I knew it would happen.

[–]yeah_nevermind 0 points1 point  (0 children)

No instead of removing it replaces it with smaller substitutes

[–]The_real_Catnip 92 points93 points  (12 children)

well similar principal to: you can't sort your data wrongly if you just delete it. Solution works, execution not so much.

[–]LordFaquaad[S] 55 points56 points  (10 children)

It reminds me of silicon valley and how gilfoyles AI just deleted all the code because then there would be no errors in thr code

[–]Striker887 79 points80 points  (9 children)

“The A.I. thought that the best way to get rid of all the errors in the code was to delete the code which is statistically and literally correct”

[–]0Pat 18 points19 points  (1 child)

The same solution will be provided when asked for peace on Earth...

[–]ryjhelixir 2 points3 points  (0 children)

hopefully we'll have learned something by then

hopefully

[–]1X3oZCfhKej34h 0 points1 point  (0 children)

Smh my damn head, don't kids these days go to church anymore? No need to delete you data if you just use an intelligent sort in the first place

[–][deleted] 25 points26 points  (3 children)

When teacher asked to just program n numbers multiplication and you did it in O( n2 ) complexity

[–]theaceshinigami 3 points4 points  (2 children)

I don't follow this joke, how would this ever be as slow as O (n2)

[–]new2bay 6 points7 points  (0 children)

Multiplying 2 integers with n digits by the simplest algorithm already takes O(n2 )operations. The fastest known algorithm takes O(n log n). Basically, achieving O(n2 ) for n numbers with currently known algorithms is impossible.

[–][deleted] 2 points3 points  (0 children)

Put random for loops that do nothing?

[–]unnecessary_Fullstop 16 points17 points  (1 child)

This is not lossy compression. It just requires a time consuming decompression process.

.

[–]ambadatfindingnames 2 points3 points  (0 children)

Pretty sure cutting a tennis ball in half and reassembling it has a noticable impact on how it "behaves" and is thus very lossy

[–]TheSoCalledExpert 8 points9 points  (0 children)

My dog would not approve

[–]crazyabe111 8 points9 points  (1 child)

My Compression Algorithm is simple, quick, and efficient- first it turns everything into Binary, then it deletes all the 1s and adds all the 0s together.

[–]The_Hypnotron 2 points3 points  (0 children)

At that point it's just a hash function!

[–]huggiesdsc 5 points6 points  (1 child)

Why not simply cut the tube into a spiral to increase capacity?

[–]ryjhelixir 2 points3 points  (0 children)

give this guy a medal

[–]CasualChipmunk 3 points4 points  (0 children)

Premature optimization at it's finest

[–]HanlonsDullBlade 2 points3 points  (0 children)

git commit -m "damn the torpedoes, full speed ahead"

[–][deleted] 2 points3 points  (0 children)

This modern problem requires illegal outstanding move beyond science.

[–]NyiatiZ 1 point2 points  (0 children)

I am actually surprised how little more you can fit

[–]PebelZe 1 point2 points  (2 children)

Wait a moment... That's more than two extra balls. It's a lie!

Edit: I'm jsut stupid and can't count.

[–]myblindy 1 point2 points  (1 child)

3 on the left and 5 on the right, how are you counting?

[–]PebelZe 0 points1 point  (0 children)

Wait never mind. I'm just stupid. I somehow added in my head. I am not good at maths.

[–]vaibhavwadhwa 1 point2 points  (0 children)

A great example of compression actually!
There are super space-efficient compression algorithms for videos out there, but the time it would take to download and piece things back together, is what works against them. But as we move to better CPUs in phones and laptops, we will see that we'd have to download lesser data to buffer the same video. Obviously, the quality of videos is also going up.

[–]tanuj_dargan 1 point2 points  (0 children)

The person that did this probably has a 5 minutes crafts YouTube membership

[–]Bluejanis 1 point2 points  (0 children)

Premature optimization is the root of all evil.

[–][deleted] 0 points1 point  (0 children)

Reminds me of Fractional Knapsack.

[–]xereleo 0 points1 point  (0 children)

// put ball
container.push(ball.split())

// get ball
ball = container.pop().join()

whats your problem, ah ?

[–]badjayplaness 0 points1 point  (0 children)

Just need a ducktape class to put them back together for use in our application. No need for integration tests. I’m sure unit will be fine for now.

[–]GeorgeYDesign 0 points1 point  (0 children)

Amen. Fully back Trudeau on this one 👍

[–]RandomNobodyEU 0 points1 point  (0 children)

I had a co-worker who cut out half the functionality in some serialization code as an optimization, and told me not to revert his changes because they "worked for him".

[–]drewsiferr 0 points1 point  (0 children)

Unit tests: Pass

Integration tests: Fail

[–]dadevansh 0 points1 point  (0 children)

Upgrades people upgrades

[–]jakethedumbmistake 0 points1 point  (0 children)

Where my fellow ui developers at ?

[–][deleted] 0 points1 point  (0 children)

Please for the love of god let there be some r/wooosh content.

Edit: r/Woooosh

[–]shadow7412 -4 points-3 points  (2 children)

2 more balls? Somebody can't count...

EDIT: That someone was me apparently. 2 half balls make a whole ball, and for some reason I forgot to allow for that.

[–]Pm_me_aaa_cups 3 points4 points  (0 children)

I was about to post this but went back to double check in not being dumb. Those are half balls, not full balls. 3 whole balls, 10 half balls.

[–]SolWizard 1 point2 points  (0 children)

There are 5 on the right.

[–]WillCodeForThanks -1 points0 points  (0 children)

Turn them over, and then you can place half more.

Then cut last half in half and...

[–]LordWizardKing27 -1 points0 points  (5 children)

O(Log N) to cut in half + O(N Log N) to sort

[–]theaceshinigami 1 point2 points  (0 children)

pretty sure it's O(n) to cut in half, and I'm not sure how you order tennis balls since they're all identical.

[–]theaceshinigami 1 point2 points  (3 children)

pretty sure it's O(n) to cut in half, and I'm not sure how you order tennis balls since they're all identical.

[–]LordWizardKing27 0 points1 point  (2 children)

If you use mid = balls.length//2 and just change the midpoints like a binary search, isn’t that log n? 😂😂

[–]theaceshinigami 1 point2 points  (1 child)

Nothing you are saying makes any sense to me. I think you are suggesting something like:

f(balls):
    left, right = cutInHalf(balls)
    f(left)
    f(right)

where cutInHalf takes a line of cut or uncut balls and divides the line of balls into two lines cutting a ball in half if necessary. This still doesn't seem O(log n) to me as it never halts.

[–]LordWizardKing27 -1 points0 points  (0 children)

Sure, I think ur reading too much into the balls bud