[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]

Fastest Algorithm

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: 31
Thread images: 5

File: fastalgorithm.png (97KB, 1266x784px) Image search: [Google]
fastalgorithm.png
97KB, 1266x784px
You can't find an algorithm that runs faster than O(-1/12) time.
>>
>sum [1..]

Why are most languages such shit? Just say what you need to say.
>>
>>8676211

Because languages that aim for simple syntax like you describe usually turn out to be unweildy on more complex problems than summing the natural numbers.

Naturally there are languages that are way much better than what OP posted, but the more terse notation will still look like a programming language
>>
exactly what do you expect will happen when i reaches MAX_INT ?
>>
>>8676211
Because a computer doesnt know what sum[1..] means.

High level programming languages are useless for doing things that require lots of optimization and speed.

C/C++ is so popular because it found a point where it is fast enough to do everything you could possibly want and it provides abstraction so what you are writing is understandable.

Try writing an OS in Haskell.
>>
your code doesn't even work the way you want it to, better just end it all.
>>
>>8676234
integer overflow causes i to become -1/12
>>
>>8676237
A computer doesn't know what "for" means either your retard.

CS freshmen get the fuck back to /g/.
>>
does anyone even get the joke? I hate all of you except OP
>>
>>8676278
Read what I said you idiot.

C/C++ provides abstractions which can be, compared to something like Haskell, easily compiled into machine code.

Implementing a for loop in assembly isnt that fucking hard, try doing the same for sum[1..] even the 1.. part requires an extensive amount of data structures and effort.

You obviously have not even slightest clue about anything CS related because you retard claimed that low level languages have no use.
Have you gone beyond fizzbuzzing in Haskell?
>>
>>8676290
You're right about the advantages of C/C++ but still, >>8676278 has a valid point when he says
>A computer doesn't know what "for" means either your retard.
>>
>>8676304
Yes he has. But figuring out what a for loop is for a computer is significantly more easy then figuring out what sum[1..] might mean.
>>
>>8676311
Yea so what? Just cause something is not as easy is no reason not to do it.
>>
This is a java code.
What is this program suposed to do?
>>
>durr abstraction is bad!!!
The state of modern CS education.
>>
>>8676004
Nice meme, but that code runs in O(n^2) time.
>>
>>8676004
Cashmeout side and my algorythm will have you dropped on the ground before you know it.
>>
>>8676286
I guess the 'joke' has something to do with a negative runtime implying it ran backwards in time? Does your runtime analysis method require the code to be executed? You seem to imply it since you make a point of it not being called? Or is that an error code, since the logic is flawed and the first variable to overflow is res?
>>
>>8676315
High level programming languages most of the time are less efficient, make it harder to optimize and removes the programmer from what is actually going on (this is often (but not always) a good thing).
There are also some things (eg. OSs) where low level languages are needed.

There is no reason why generally languages with high levels of abstraction are supperior. The best choice is always depended on what you actually want to achive.
>>
>>8676004
This function calculates the value of 1+1+1+... rather than 1+2+3+... so it should return -1/2 and not -1/12
Also
>-1/12
>int
>>
>>8676286
No it's a reference to the meme 1+2+3+...= -1/12
>>
File: Yaranaika.jpg (239KB, 520x638px) Image search: [Google]
Yaranaika.jpg
239KB, 520x638px
>>8676286
mfw CS autists don't recognize /sci/'s worst meme on sight
>>
>>8676966
this
>>
hold on. It calculates
1+
1+2+
1+2+3+
1+2+3+4+
:
1+2+...n
until an overflow error in res occurs.
how, in what world does this relate in any way to negative one half or -1/12??
what is this? and what has the result to do with the running speed of the algorithm?
>>
>>8676004
According to human language yes.

There's no physical law that prevents algorithms from running any time. Hell, there's aliens that can run algorithms with energy only and zero expenditure of time.
>>
File: 1486861760697.jpg (73KB, 450x796px) Image search: [Google]
1486861760697.jpg
73KB, 450x796px
>>8677073

Was it OP all along ? Yes ? I knew it was him, he keeps on fucking with people, I don't know what to do with him. I guess we'll have to get him killed.
>>
>>8676004
>>8676261
I really really like this meme!
>>
>>8676356
gtfo of /sci/
>>
File: image.png (132KB, 680x680px) Image search: [Google]
image.png
132KB, 680x680px
>ITT taking an obvious troll post seriously
>>
>>8676278
it's still a whole levels of abstraction closer, don't be such moron
>>
File: mfw.png (109KB, 342x421px) Image search: [Google]
mfw.png
109KB, 342x421px
THank you op for this meme
Rumanjin sum at best
Thread posts: 31
Thread images: 5


[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.