DSA Youtube Playlist Flashcards
(75 cards)
What is a data structure?
A way of organizing data so that it can be used effectively
What is an abstract data type?
A theoretical model that defines a data structure by its behavior (operations) and properties, independent of its implementation. It specifies what operations can be performed but not how they are implemented
What are implementations (data structures) that can be used for a list abstraction (abstract data type)?
Dynamic array, linked list
What are implementations (data structures) that can be used for a queue abstraction (abstract data type)?
Linked list based queue, array based queue, stack based queue (not a good implementation)
What are implementations (data structures) that can be used for a map abstraction (abstract data type)?
Tree map, hash map/hash table
What is Big-O notation?
It gives an upper bound of the complexity in the worst case, helping to quantify performance as the input size becomes arbitrarily large
What is the Big-O complexity for constant time?
O(1)
What is the Big-O complexity for logarithmic time?
O(log n)
What is the Big-O complexity for linear time?
O(n)
What is the Big-O complexity for linearithmic time?
O(n log n)
What is the Big-O complexity for quadratic time?
O(n^2)
What is the Big-O complexity for cubic time?
O(n^3)
What is the Big-O complexity for exponential time?
O(b^n), b > 1
What is the Big-O complexity for factorial time?
O(n!)
What is the Big-O of finding all subsets of a set?
O(2^n), exponential time
What is the Big-O of finding all permutations of a string?
O(n!), factorial time
What is the Big-O of sorting using mergesort?
O(n log n), linearithmic time
What is the Big-O of iterating over all the cells in a matrix of size n by m?
O(n * m)
What is a static array?
[Change] A fixed length container containing n elements indexable from the range [0, n-1]. Arrays: A collection of elements stored in contiguous memory locations, accessible by index.
When and where is a static array used?
- Storing and accessing sequential data
- Temporarily storing objects
- Used by IO routines as buffers
- Lookup tables and inverse lookup tables
- Can be used to return multiple values from a function
- Used in dynamic programming to cache answers to subproblems
What is the time complexity of accessing an element in a static array?
O(1)
What is the time complexity of accessing an element in a dynamic array?
O(1)
What is the time complexity of searching for an element in a static array?
O(n)
What is the time complexity of searching for an element in a dynamic array?
O(n)