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

Автор Rajan_sust, история, 6 лет назад, По-английски

If a String is : "Topcoder" and all of it's suffix are :

r,er,der,oder........pcoder,Topcoder

Now consider c++ code:

std::string str = "Topcoder";
const char* pointer = &str[1];
cout<<pointer<<'\n';

Output is: opcoder

What is the complexity of generating of above suffix upto 1 index of length 7? Linear or Constant ?

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

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

Constant for generating the pointer, Linear for output.