• 0

is c# better then c++?


Question

Recommended Posts

  • 0

Ehm. Does it matter what complexities or whatever the things have?

YES! Aside from ensuring good scalability it also prevent DoS attacks.

For example Python recently changed their implementation of their hash tables because with certain input the complexity could end up closer to O(n) rather than an average of O(1).

This is also why we have data structures like tree-based dictionaries and sets which guarantee at worst O(log n) or O(n log n) for certain operations.

Which ensure that the O(n) behaviour will never occur, no matter what input you feed the data structure.

This is one of the reasons C++ had a tree based map before it had a hash table based map, because of the stricter complexity guarantee.

An example of a DoS attack:

Imagine feeding a server with some information it stores in a dictionary which gets very large.

The server often does lookups on this dictionary.

If you can force it to take longer to perform these look ups (O(n) instead of an average of O(1)), then you can increase the amount of work it should have to do.

This makes it less scallable, making it easier to flood with "fake" users, thus denying service to real users.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.