Блог пользователя RifatALmuiN

Автор RifatALmuiN, история, 5 месяцев назад, По-английски

First one (2027 ms): 253857814
The second one (249 ms): 253859120

In my observation, both of them have a time complexity of O(n2logn2)

  • First one: I created a vector of pairs that have a size of nearly n2 and inserted all of them in a map which will take O(n2logn2) time complexity.
  • Second one: I created a vector of pairs with a similar size of nearly n2. And I then sorted it which will take O(n2logn2) time complexity.

Then why the second approach is taking so much less time?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится