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

Автор Decoder_69, история, 3 года назад, По-английски

Hello Coders!!I need some suggestion while I have started learning STL I have learned vectors,pairs etc but I didn't get the approach to apply which stl nd where in the question.Plzz suggest something from where I get good grasp in stl nd some resourses to learn STL..any suggestion will be welcome.

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

»
3 года назад, # |
  Проголосовать: нравится +36 Проголосовать: не нравится

Practice.

»
3 года назад, # |
  Проголосовать: нравится +39 Проголосовать: не нравится

Firstly, don't force yourself into thinking what STL I need here. Let's say you design an algorithm. Say you need to perform $$$I$$$ insertions, $$$D$$$ deletions, $$$S$$$ searches, you get the idea. Now you know the time complexity of each operation. The time complexity of your code will be $$$O(IT_I(n) + DT_D(n) + ST_S(n))$$$, $$$T_D(x)$$$ stands for time complexity of deletion, and the rest are similarly defined. Now you can compute the time complexity based on what data structure you are using, and what is the time complexity for each operation. So you want the one that minimises the time complexity of $$$O(IT_I(n) + DT_D(n) + ST_S(n))$$$.