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
New Zealand can eat me
Aug 29, 2008

:matters:


:wrong:

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
ur right i fixed it. 2 be fair gently caress trying to get gtm spooled up on a tablet, im writing this poo poo off the top of my head.

this is why i always fail at white board coding. i decide im done too fast and i think im a little dyslexic with code.

Cybernetic Vermin
Apr 18, 2005

Lutha Mahtin posted:

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

the first round of quicksort has you comparing the entire list to the pivot element, the invariant used in the recursion becomes very simple (i.e. the half of the list to the left of the pivot contains all elements that are to be to the left of the pivot when finished), and there can only be so many pivots to go through. bubble sort has the invariant that at each step two elements are put into the correct order in relation to each other, and there are only so many pairs of elements in the list. stooge sort is by comparison tricky to see the functioning of

i will stop trying to talk you into something being difficult if you don't find it difficult though, if you found the right intuition it is not like it is some truly difficult task, but e.g. student usually don't very quickly

hobbesmaster
Jan 28, 2008

Cybernetic Vermin posted:

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

"well thats easy its just... wait what no. it is worse than bubble sort"

loving O(n(log(3)/log(1.5)) :lol:

apparently its a really common problem in algorithms classes but i don't remember it :shrug:

Share Bear
Apr 27, 2004

The Management posted:

I just use HashMap for everything, op

this but unironically

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
bogosort is pretty cool

hobbesmaster
Jan 28, 2008

while cool, quantum bogosort is the best

Captain Foo
May 11, 2004

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

hobbesmaster posted:

while cool, quantum bogosort is the best

Haha

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Lutha Mahtin posted:

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
look even if you somehow understand intuitively that it's a sort, there's still a challenge to lay out the argument from which it follows.

In particular (and don't post answers):

- what are the postconditions of each recursive step
- why are they each ensured
- would it still be a sort if the swap were done only for sublists of length 2

Gazpacho fucked around with this message at 05:20 on Sep 9, 2016

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
my postcondition: terrible

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
op I was reading about the meanshift algorithm the other day and it's p rad

https://saravananthirumuruganathan.wordpress.com/2010/04/01/introduction-to-mean-shift-algorithm/

Lutha Mahtin
Oct 10, 2010

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

i wonder if radix sort is banned in germany

Captain Foo
May 11, 2004

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


i have no idea what any of this means

unpacked robinhood
Feb 18, 2013

by Fluffdaddy
just took a mean shift and can confirm its p. rad

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Captain Foo posted:

i have no idea what any of this means

it's a clustering algorithm, like this: http://stanford.edu/class/ee103/visualizations/kmeans/kmeans.html

Captain Foo
May 11, 2004

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


Oh ok this is actually cool

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

i use akra-bazzi, op

Uncle Enzo
Apr 28, 2008

I always wanted to be a Wizard
walked into a co-workers cube and and told him I wanted to make a naive delauney triangulation algorithm for shits and giggles.

got almost an hour before I gave up and started reading literature, all my assumptions were wrong

BONGHITZ
Jan 1, 1970

haha very productive work day!

Lutha Mahtin
Oct 10, 2010

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

Uncle Enzo posted:

got almost an hour before I gave up and started reading literature, all my assumptions were wrong

yospos.o

ahmeni
May 1, 2005

It's one continuous form where hardware and software function in perfect unison, creating a new generation of iPhone that's better by any measure.
Grimey Drawer

Uncle Enzo posted:

walked into a co-workers cube and and told him I wanted to make a naive delauney triangulation algorithm for shits and giggles.

got almost an hour before I gave up and started reading literature, all my assumptions were wrong

never implement your own math because math is hard
delaunay triangulation is cool though, I used it in a procedural generated room system that I implemented in js:

Cybernetic Vermin
Apr 18, 2005

Uncle Enzo posted:

walked into a co-workers cube and and told him I wanted to make a naive delauney triangulation algorithm for shits and giggles.

got almost an hour before I gave up and started reading literature, all my assumptions were wrong

it really seems like one of those problems where modest improvements on the naive algorithm would still often perform really well, since the neighborhood you need to consider for each point can be bounded pretty strictly (i.e. you can discard any pair of points which by themselves already fail the circle condition, which will be a lot of candidates discarded), and it seems fairly probable that you'll be able to chew up a fair bit of the outer boundary based off of point which can only be used in one way

granted i am then likely falling in all the same traps as you, but it indeed is one that intuitively seems pretty doable ;)

atomicthumbs
Dec 26, 2010


We're in the business of extending man's senses.

a.out of YOSPOS

Uncle Enzo
Apr 28, 2008

I always wanted to be a Wizard
yeah i just want to make an implementation for my own understanding, we use TIN's every day in my job. the datasets we tin are getting to be 8tb and bigger, with 10's of billions of points. I want something that will work on, like, 100 points, written in whatever.

also I've got an idea to make a multidimensional tin to interpolate other point attributes besides elevation. not sure if it's been tried before but this stuff isn't really my job, so i have total freedom to fail.

Bloody
Mar 3, 2013

here is a collection of my favorite algorithms
https://graphics.stanford.edu/~seander/bithacks.html
specifically, the ones that aren't super platform dependent

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Bloody posted:

here is a collection of my favorite algorithms
https://graphics.stanford.edu/~seander/bithacks.html
specifically, the ones that aren't super platform dependent

wow

im amazed something good came out of this post

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮

Bloody posted:

here is a collection of my favorite algorithms
https://graphics.stanford.edu/~seander/bithacks.html
specifically, the ones that aren't super platform dependent

:eyepop:

Lutha Mahtin
Oct 10, 2010

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

:worship: :eyepop: :stare: :spergin: :science:

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
the only algorithm it doesnt have is one for writing good posts

Cybernetic Vermin
Apr 18, 2005

Uncle Enzo posted:

yeah i just want to make an implementation for my own understanding, we use TIN's every day in my job. the datasets we tin are getting to be 8tb and bigger, with 10's of billions of points. I want something that will work on, like, 100 points, written in whatever.

also I've got an idea to make a multidimensional tin to interpolate other point attributes besides elevation. not sure if it's been tried before but this stuff isn't really my job, so i have total freedom to fail.

from teaching algorithm design a bit i find that the most common reason why people fail to make an initial working naive algorithm is almost invariably that they literally cannot resist being too clever about it. for delauny triangulation one should certainly start with an outer loop which literally enumerates all ways of connecting a subset of the points with lines, and then discarding everything that is not a triangulation (the ridiculously vast majority of it) and then everything that fails the delauny condition. then one moves the conditions from the those two filtering steps up into the generator step bit by bit (likely discovering some more clever way to do it as one works)

ended up pondering it a bit, and it is surprisingly interesting to come up with an algorithm which decides whether a set of line segments describes a triangulation or not (not exactly hard, but it took me a bit of effort before i had a succinct statement)

VikingofRock
Aug 24, 2008




Bloody posted:

here is a collection of my favorite algorithms
https://graphics.stanford.edu/~seander/bithacks.html
specifically, the ones that aren't super platform dependent

The book "Hacker's Delight" has a ton of these and it makes for really fun and interesting reading if bit-level hacks are your bag

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
breadth-first is the best way to search.


Silver Alicorn posted:

bresenham line algorithm is pretty much the only one I understand & have inplemented

I gave an intern a project involving implementing this and man i had no idea you could gently caress up something this straightforward so badly

Gazpacho posted:

my postcondition: terrible

heh

unpacked robinhood
Feb 18, 2013

by Fluffdaddy

rotor posted:

I gave an intern a project involving implementing this and man i had no idea you could gently caress up something this straightforward so badly

i cced an implementation off stackoverflow for my project, is there any other way ?

Radio Paranoia
Jun 27, 2010

It is now safe to turn off your computer.

Loving Africa Chaps posted:

algorithms? yeah i got some



https://www.youtube.com/watch?v=kPRA0W1kECg

vaguely soothing computer noises

Instant Grat
Jul 31, 2009

Just add
NERD RAAAAAAGE
https://www.youtube.com/watch?v=xP5-iIeKXE8

New Zealand can eat me
Aug 29, 2008

:matters:


LeftistMuslimObama posted:

ur right i fixed it. 2 be fair gently caress trying to get gtm spooled up on a tablet, im writing this poo poo off the top of my head.

this is why i always fail at white board coding. i decide im done too fast and i think im a little dyslexic with code.

I just wanted to use the new Smiley, I'm glad I was right though

Bloody
Mar 3, 2013

rotor posted:

breadth-first is the best way to search.

why? i struggle with this interview question all the time. we talk about dfs, we talk about bfs, then they're like "use which one when" and im like "uhh it depends?"

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
Nice!

hobbesmaster
Jan 28, 2008

Bloody posted:

why? i struggle with this interview question all the time. we talk about dfs, we talk about bfs, then they're like "use which one when" and im like "uhh it depends?"

its what you say after "uhh, it depends"

the "cheap" answer is if you know its deep go depth first, if you know its shallow go breadth first. however, depth first does not require you to store the frontier so if its too wide depth first is your only option. but depth first could be an issue if its too deep so you'd need to use iterative deepening.

djikstra's algorithm is the best though :v:
(a* if you need to get fancy)

Adbot
ADBOT LOVES YOU

Cybernetic Vermin
Apr 18, 2005

a* indeed the correct choice, constant heuristic for dijkstras, constant heuristic and weights for breadth first, some really sweet guarantees, it has it all~

  • Locked thread