Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
post and dicsuss your fav algorithms here

Adbot
ADBOT LOVES YOU

Chumbawumba4ever97
Dec 31, 2000

by Fluffdaddy
<?php
//logout.php
session_start();
session_destroy();
header("location: logout.php");
?>

The Management
Jan 2, 2010

sup, bitch?
I just use HashMap for everything, op

Incomplete Fish
Apr 22, 2006

Grimey Drawer
while(true){
cout << "Penus ";
}

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
bresenham line algorithm is pretty much the only one I understand & have inplemented

bump_fn
Apr 12, 2004

two of them
shor's algorithm

My Linux Rig
Mar 27, 2010
Probation
Can't post for 6 years!
but what are some of the trendiest algorithms? I wanna be the hip programmer

The Management
Jan 2, 2010

sup, bitch?
code:

send(to, from, count)
register short *to, *from;
register count;
{
    register n = (count + 7) / 8;
    switch (count % 8) {
    case 0: do { *to = *from++;
    case 7:      *to = *from++;
    case 6:      *to = *from++;
    case 5:      *to = *from++;
    case 4:      *to = *from++;
    case 3:      *to = *from++;
    case 2:      *to = *from++;
    case 1:      *to = *from++;
            } while (--n > 0);
    }
}

New Zealand can eat me
Aug 29, 2008

:matters:


akadajet
Sep 14, 2003

he's gotten flat and fat

Loving Africa Chaps
Dec 3, 2007


We had not left it yet, but when I would wake in the night, I would lie, listening, homesick for it already.

algorithms? yeah i got some

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

The Management posted:

I just use HashMap for everything, op

unironic answer to most interview questions

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i like algorithm

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
The Traveling Dick Kicker (TDK) problem:

code:
for EVERY dick in ROOM
    DO kick();

qntm
Jun 17, 2009
the only sorting algorithms I can remember are the joke ones

OzyMandrill
Aug 12, 2013

Look upon my words
and despair

karatsuba!

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

fisher-yates bithc

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
code:
if (oneWay || !oneWay)
{
   self.findya();
   self.getcha();
   self.getcha();
   self.getcha();
   self.getcha();
}

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Gazpacho posted:

code:
if (oneWay || !oneWay)
{
   self.findya();
   self.getcha();
   self.getcha();
   self.getcha();
   self.getcha();
}

lol

suspicious donkey!
Jun 26, 2013
i like to algorithm when i get the blues

The Leck
Feb 27, 2001

Loving Africa Chaps posted:

algorithms? yeah i got some


lol at the concept of reversing entropy

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

qntm posted:

the only sorting algorithms I can remember are the joke ones

i remember the general outline of how some of them work. but if i ever find myself in a 1980s action movie scenario, and to defuse the bomb i would need to implement a bug-free quicksort from memory, well, that school bus full of puppies ain't gonna make it

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i could do the haskell not actually in place version of quicksort to defuse the bomb i think

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i'm pretty sure i could also do sleep sort to defuse the bomb but thats it

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
you cut one wire and if it explodes you reject the PR
duh

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Jonny 290 posted:

you cut one wire and if it explodes you reject the PR
duh

no you approve with comments and it just automerges and blows up everything.

qntm
Jun 17, 2009
Fonz sort is when you go up to sort the array but it's already sorted because you're just that awesome, eyyyy

checking that the array might be already sorted improves the best-case performance of some algorithms from O(n log n) to O(n), e.g. Fonz merge sort, Fonz heap sort

Cybernetic Vermin
Apr 18, 2005

stooge sort is the best

* if the last element is smaller than the first, swap them
* if the list is of length >= 3
-- recurse on the first 2/3 of the list
-- recurse on the last 2/3 of the list
-- recurse on the first 2/3 of the list again
* done!

Glans Dillzig
Nov 23, 2011

:justpost::justpost::justpost::justpost::justpost::justpost::justpost::justpost:

knickerbocker expert
has anyone said "Djikstra's out for Harambe" yet

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Glans Dillzig posted:

has anyone said "Djikstra's out for Harambe" yet

that's the joke!!!!!!!!

DONT THREAD ON ME fucked around with this message at 18:47 on Sep 7, 2016

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Cybernetic Vermin posted:

stooge sort is the best

* if the last element is smaller than the first, swap them
* if the list is of length >= 3
-- recurse on the first 2/3 of the list
-- recurse on the last 2/3 of the list
-- recurse on the first 2/3 of the list again
* done!
its fun to work through the reasoning of why tihs is a working sort (nobody post the reasoning)

Glans Dillzig
Nov 23, 2011

:justpost::justpost::justpost::justpost::justpost::justpost::justpost::justpost:

knickerbocker expert

MALE SHOEGAZE posted:

that's the joke!!!!!!!!

sorry, I don't "get" jokes unless they're all spelled out for me

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

Gazpacho posted:

its fun to work through the reasoning of why tihs is a working sort (nobody post the reasoning)

are there some subtle tricky parts to it? b/c to me it just looks like a silly overcomplicated version of quicksort and bubblesort mashed together

burning swine
May 26, 2004



the best algorithm is actually johnson trotter welp ttyl

oh no blimp issue
Feb 23, 2011

i made an alorithm to solve traveling salesman in O(n) time but i can't be bothered to tell you

Cybernetic Vermin
Apr 18, 2005

Lutha Mahtin posted:

are there some subtle tricky parts to it? b/c to me it just looks like a silly overcomplicated version of quicksort and bubblesort mashed together

depends on your intuition, but the way it doesn't ever really look at the whole list at once makes for some mental gymnastics to convincingly argue that everything will in the end end up in the right places

if you find that too easy the next step is to figure out the computational complexity of it

hobbesmaster
Jan 28, 2008

Awia posted:

i made an alorithm to solve traveling salesman in O(n) time but i can't be bothered to tell you

well yeah, you just have to find out if pittsburgh is in the list. why would you go anywhere else?

hobbesmaster fucked around with this message at 22:29 on Sep 7, 2016

oh no blimp issue
Feb 23, 2011

hobbesmaster posted:

well yeah, you just have to find out of if pittsburgh is in the list. why would you go anywhere else?

dont share my secrets!

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

Cybernetic Vermin posted:

depends on your intuition, but the way it doesn't ever really look at the whole list at once makes for some mental gymnastics to convincingly argue that everything will in the end end up in the right places

maybe im misremembering my algorithms basics, but i thought "doesn't look at the whole thing at once" was the idea behind the divide and conquer strategy. stooge just does it in a very silly way

quote:

if you find that too easy the next step is to figure out the computational complexity of it

nah, i'm cool :lol:

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
i wrote this sorting algorithm for u, given a numerically indexed array it prints the values in sorted order

code:
n(n,e) n f,w,s,x,d
	s d="s w(n(f))="""""
	f f=1:1:e d @d
	s x="w s_"""""
	f  s s=$o(w(s)) q:s]]"" x x
	q

The MUMPSorceress fucked around with this message at 05:36 on Sep 8, 2016

  • Locked thread