Python programmer vs C programmer (speedrun)

preview_player
Показать описание
Those Data Structures & Algorithms give me nightmares...

Python programming language is perceived as slow but easy to write, and C perceived as fast, but slow to write...

Music in the end: Mick Gordon - The Only Thing They Fear Is You (from Doom OST)
Рекомендации по теме
Комментарии
Автор

I like that fact you can type faster when writing in C. I think that's the best feature of that language.

Tekay
Автор

C is such a high level language... Glad i started with electric circuits applied to the radio in the 1890s

TileBitan
Автор

Try in JS, and it returns the string “true”, which equates to false.

steveoc
Автор

As a C programmer, i can confirm doom music is playing when we start typing

danb
Автор

I also write C in 4x speed compared to Python for some odd reason.

onee
Автор

Python dev would have done list(set(a) & set(b))

vaulttectradingco
Автор

CS major here:
Python is an interpreted language. That means the keyboard has to do extra work before the keystrokes can be send to the PC. That's why it is usually faster to type in C.

cookie_space
Автор

Your C code is O(n*m). You could sort the arrays first and then use two pointers to compare the sorted arrays and check for intersection. This would drop it down to O(n*logn + m*logm + m + n) which simplifies to O(n*log(n) + m*log(m)). This assumes an efficient sort algo like mergesort that offers O(xlogx)-. In case n>m, the final time complexity is O(n*log(n)).

bayzed
Автор

I like the fact that he uses vi just for C

ademyro
Автор

In python you can simply do print(*c).
No need to use join and map.

St_
Автор

You could write print(*c) instead of print(" ".join(map(str, c)))

leu
Автор

C is very user friendly. He's just choosy about his friends.

Elfcheg
Автор

And the program in C, of course, has an error in working with memory.

МаксимКайтмазян-лю
Автор

The soundtrack for each language gives very accurate feeling about the skill level of each programmer. C programmers are superior of course

EarlyBitcoiner
Автор

Your C code and Python code work differently if there can be duplicates in the arrays.

If there are `n` of the same in a, and `m>0` of the same in b, then your Python code will give `n` duplicates, while your C code will give `n × m` duplicates, which might mean you go into unallocated memory

This flaw in the C code could be very easily fixed by adding a `break;` after finding the first bi such that `a.arr[ai] == b.arr[bi]`. (i.e. after line 18)

Eknoma
Автор

Every time I see calloc I remember why I suffer from depression

Pokedollar
Автор

Impressive. Very nice. Let's see a Rust developer's speedrun.

BassHero
Автор

And remember, just because it's written in C, doesn't mean you programmed it to run faster.

DaJodad
Автор

most accurate part was that the C programmer coded in VI

but the C programmer should have just ended on getting a segfault lmao

electra_
Автор

This is weird, , since most Python interpreters actually written in C

mekatronikachmadi