C++
Which of t ...
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
Which of the following containers is have search complexity O(n)?
std::vector
std::list
std::set
std::hash_set
Explanation
std::set
has logarithmic complexity (red-black tree). The complexity of
std::hash_set
depends heavily on the implementation of the hashing function, but it is tried to be selected in such way that the element is accessed with constant complexity.
complexity
containers library
std::string
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Какова трудоёмкость метода iterator erase (const_iterator position), в ассоциативных контейнерах?
Для даных итераторов по vector, будет ли ругаться компилятор на какуе-то из отмеченых строк кода? vector<int> vec(3,1); const std::vector<int>::iterator iter = vec.begin(); *iter = 10; //1 ++iter; //2 std::vector<int>::const_iterator iter2 = vec.begin(); *iter2 = 10;//3 ++iter2; //4
При передаче массива по ссылке, что выводится на экран в результате работы программы со следующим кодом? #include <iostream> using namespace std; void f(int (&a)[11]) { cout << sizeof(a) << endl; } int main() { int a[10]; cout << sizeof(a) << " "; f(a); return 0; }
Отметьте строки с ошибкой инициализации:
Какой из ниже перечисленных методов позволяет быстрее всего получить отсортированный контейнер элементов int и найти заданное значение value( которое присутствует в контейнере) бинарным поиском? 1. set<int> iset; iset.insert(...); .... // add several more values set<int>::iterator it = lower_bound(begin(iset), end(iset), value); 2. vector<int> ivect; ivect.reserve(...); // reserve memory for elements ivect.push_back(...); .... // add several more values sort(begin(ivect), end(ivect)); vector<int>::iterator it = lower_bound(begin(ivect), end(ivect), value); 3. set<int> iset; iset.insert(...); .... // add several more values set<int>::iterator it = iset.lower_bound(value); 4. unordered_set<int> iuset; iuset.insert(...); .... // add several more values sort(begin(iuset), end(iuset)); unordered_set<int>::iterator it = lower_bound(begin(iuset), end(iuset), value);
C
++
Quiz
Login to learn C++
or
Read more about
C++ Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
C++ quizzes
int main() { const int* i = int(); // 1 int const* j = int(); //2 int* const k = int(); //3 int* l(); //4 ++i; //5 ++j; //6 ++k; //7 ++*k; //8 ++l; //9 } Откомпилируется ли такой код? Если нет, то в каких строчках будут ошибки компиляции? После стандарта C++14.
Какой результат работы программы? #include <iostream> using namespace std; void f(double) { cout<<"f1"<<endl; } void f(const int ) { cout<<"f2"<<endl; } void f( int & ) { cout<<"f3"<<endl; } void main(void) { int n = 1; double b = 2; f(n); f(b); }
#include <iostream> using namespace std; int &test() { static int a = 3; return a; } int main() { ++++++test(); cout << test() << endl; return 0; } Что выведет cout?
При истинности какого из приведенных высказываний имеет смысл вычитание указателей?
Какое ключевое слово используется для описания пространства имен?
В чем разница между X x; и X x(); ?
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment