Fastest Algorithm

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.

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 ?

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.

integer overflow causes i to become -1/12

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

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?

You're right about the advantages of C/C++ but still, has a valid point when he says
>A computer doesn't know what "for" means either your retard.

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.

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.

Nice meme, but that code runs in O(n^2) time.

Cashmeout side and my algorythm will have you dropped on the ground before you know it.

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?

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.

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

No it's a reference to the meme 1+2+3+...= -1/12

mfw CS autists don't recognize Veeky Forums's worst meme on sight

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?

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.

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.

I really really like this meme!

gtfo of Veeky Forums

>ITT taking an obvious troll post seriously

it's still a whole levels of abstraction closer, don't be such moron

THank you op for this meme
Rumanjin sum at best