time complexity Flashcards

1
Q

what is time complexity

A

time complexity of an algorithm describes how time taken to execute it grows with the size of the input data
- time complexity does not indicate actually performance

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

linear search, insert remove

A

search: O(1)
insert: O(n)
remove: O(n)

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

linked list search, insert remove

A

search: O(n)
insert: O(1)
remove: O(1)

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

binary search, insert remove

A

search: O(log(n)); worse case (O(n))
insert: O(log(n))
remove (leaf node/ one child node): O(1)
remove (two-child node): O(log(n))

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