[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Cool Algorithms

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 17
Thread images: 2

File: happypepe.jpg (46KB, 533x477px) Image search: [Google]
happypepe.jpg
46KB, 533x477px
Share your favorite Computer Science algorithms and tell us what it does!
>>
bogosort
>>
>>8884780
Combsort: O(n^2) average case but keeps up with Merge/Heap/Quicksort which proves CS is worthless.
>>
>>8884799
I don't think you understand CS if you think comb sort keeps up with quick sort or merge sort
>>
>>8884780
sum=0
for i in range(0, infinity):
sum+=i

print(sum)

output:-1/12
>>
>>8884809
True that
>>
>>8884809

Code it up and see. It's within a factor of 2~4 of the other algorithms when n is well into the hundreds of millions.

This is what you get for ignoring constant factors in the real world.
>>
>>8884784
Can I get a quick rundown on bogosort?
>>
>>8884821
>Efficient sorts bow down to it
>>
>>8884819
If you're trying to make a comment about O(n) analysis, it's a measure of how the function grows, not the actual efficiency.
>>
>>8884819
>2-4 times slower than a real algorithm

I'm supposed to be impressed?
>>
>>8884821
>consider an array of numbers
>find random permutations of the numbers
>that is, till you find one that is sorted.
>there's your answer.
>>
>>8884799

False. The better performance you see in practice can be seen when you consider the asymptotic average-case analysis of the algorithm. The body of techniques within the sub-field of algorithmic analysis is more than robust enough to encompass this phenomenon. Just because you aren't educated enough to know of these techniques doesn't mean that they don't exist, and it certainly doesn't mean that "CS is worthless."

By the way, there are also models of computational analysis which are, in fact, sensitive to constants.
>>
I think the ellipsoid method of solving convex optimization problems is pretty interesting. In addition to being the first strongly polynomial-time algorithm for solving linear programs in the general case, it's pretty neat in that it lends itself so well to such an intuitive geometric interpretation.
>>
File: Capture.jpg (109KB, 1088x455px) Image search: [Google]
Capture.jpg
109KB, 1088x455px
>>8884780
Damerau–Levenshtein distance because pic related.

What it does: https://en.wikipedia.org/wiki/Edit_distance

+ I used it to make my first auto correct, and I was super excited about it. (not the best way for making an auto correct btw)
>>
>>8884831
>The better performance you see in practice can be seen when you consider the asymptotic average-case analysis of the algorithm

Average case [math]IS[/math] what he was referring to.

http://stackoverflow.com/questions/22595728/what-is-the-running-time-of-comb-sort
>>
>>8884780
https://en.wikipedia.org/wiki/Fast_inverse_square_root
Thread posts: 17
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.