The comparison between the performance of the string class time on set / map like container

About set / map performance indicators of the string class vessel

Test subject:

https://codeforces.com/contest/1287/problem/B

Wherein the string conditions tested:

String length of <= 30,

The number string <= 1500,

Each of equal length and a string query and join.

Using the set / map to detect whether a container such as a length of a character string and the like exist.

Cin closed after use synchronous / cout be IO

Test results as shown above.

in conclusion:

In the above string conditions:

Time Indicator: set significantly better than the map unordered_set / unordered_map are better set / map
Space index: set significantly better than the map unordered_set / unordered_map are better set / map
### to sum up: For the string class, set in the space-time map are better than Because the number of strings is <= 1500, the internal hash algorithm employed unordered_set / unordered_map are better set / map

By text link below to view the corresponding code.

68947873 Jan/17/2020 00:51UTC+8 QieziMin B - Hyperset GNU C ++ 14 Accepted 576 ms 400 KB
68947783 Jan/17/2020 00:50UTC+8 QieziMin B - Hyperset GNU C ++ 14 Accepted 1107 ms 106100 KB
68947742 Jan/17/2020 00:49UTC+8 QieziMin B - Hyperset GNU C ++ 14 Accepted 2184 ms 106200 KB
68947641 Jan / 17/2020 00: 47UTC + 8 QieziMin B - Hyperset GNU C ++ 14 Accepted 624 ms 400 KB

ps: this test data only condition for this problem.

Guess you like

Origin www.cnblogs.com/qieqiemin/p/12203996.html