Headers function Flashcards

1
Q

Vector- size()

A

Return number of items (unsigned integral type)

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Vector - capacity()

A

Return number of items it can hold (unsigned integral type)

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Vector - empty()

A

Return true or false (boolean)

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Vector - at(index)

A

Return a reference to the element at index
Exception out_of_range will throw if out of bound

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Vector - push_back(item)

A

Add item to the end of the vector

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Vector- insert(iterator position,{(item) or (n, item)or (input iterator first, input iterator last)})

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Vector - pop_back()

A

Remove the last element from the vector

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Vector - begin()

A

Return an iterator pointing to the first element

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Vector - back()

A

Return a reference to the last element

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Vector - front ()

A

Return a reference to the first element

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Vector - end()

A

Return an iterator pointing to the last element

Time complexity: O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Cassert - assert(expression)

A

Terminates the program if expression = 0 / false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

cctype - isalnum(char)

overloaded functions in locale

A

Return true if given char is an alphanumeric character
False otherwise

Alphanumeric character = decimal digit / uppercase and lowercase letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

cmath - cbrt(double)

A

Return cubic root of the given number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly