Headers function Flashcards
Vector- size()
Return number of items (unsigned integral type)
Time complexity: O(1)
Vector - capacity()
Return number of items it can hold (unsigned integral type)
Time complexity: O(1)
Vector - empty()
Return true or false (boolean)
Time complexity: O(1)
Vector - at(index)
Return a reference to the element at index
Exception out_of_range will throw if out of bound
Time complexity: O(1)
Vector - push_back(item)
Add item to the end of the vector
Time complexity: O(1)
Vector- insert(iterator position,{(item) or (n, item)or (input iterator first, input iterator last)})
Insert item to the given position
Insert n items to the given position
Insert the given item in range to the given position
Time complexity: O(n+m) where n is the number of item insets and m is the elements moved
Vector - pop_back()
Remove the last element from the vector
Time complexity: O(1)
Vector - begin()
Return an iterator pointing to the first element
Time complexity: O(1)
Vector - back()
Return a reference to the last element
Time complexity: O(1)
Vector - front ()
Return a reference to the first element
Time complexity: O(1)
Vector - end()
Return an iterator pointing to the last element
Time complexity: O(1)
Cassert - assert(expression)
Terminates the program if expression = 0 / false
cctype - isalnum(char)
overloaded functions in locale
Return true if given char is an alphanumeric character
False otherwise
Alphanumeric character = decimal digit / uppercase and lowercase letter
cmath - cbrt(double)
Return cubic root of the given number