Algorithms and Data Structure
If you are the beginner to data structure and algorithms, I recommend the following videos from Free Code Camp.
- Algorithms and Data Structures Tutorial - Full Course for Beginners: https://youtu.be/8hly31xKli0
- Data Structures Easy to Advanced Course - Full Tutorial from a Google Engineer: https://youtu.be/RBSGKlAvoiM And you must know about Big O Notation.
- Big O Notation: https://youtu.be/Mo4vesaut8g
-
array Time and Space Complexity of Array:
Traversing
Traversing Array: Time Complexity O(n), Space Complexity O(1)
Insertion
Inserting the element to the first position of the Arrray: Time Complexity O(n)
Inserting the element to the last position of the arry: Time Complexity O(n) if the array is static O(1) if the array is dynamic,
Inserting the element (not first and last): Time Complexity O(n)
Deletion
Deleting the first element from an array: Time Complexity O(n)
Deleting the last element from an array: Time Complexity O(1)
Deleting an element in the middle of the array: Time Complexity O(n)
Copying
Copying array: Time Complexity O(n) Space Complexity O(n)
Accessing
Accessing an element at a given index: Time Complexity O(1) Space Complexity O(1)
Updating Updating and element at a given index: Time Complexity O(1) -
matrix
-
string Time and Space Complexity of Array:
Traversing
Traversing String: Time Complexity O(n), Space Complexity O(1)
Copying
Copying string: Time Complexity O(n) Space Complexity O(n)
Accessing
Accessing an element at a given index: Time Complexity O(1) Space Complexity O(1)Time Complexity of O(nm) n is the number of words, m is the the max length of the words Space Complexity also O(nm) if there can be any length of the word, it would be more accurate if we contains m words = ["cat", "dog", "cow"] ans = [] for i in words: reveresed_word = i[::-1] ans.append(i)
-
linked-list
-
tree Tree is a type of graph. Common Types of Trees: Binary Tree and Binary Search Tree, Min Heap, Max Heap, Tries
-
graph Vertices are values and edges are connection.
- sliding window
- bit manipulation
- stack/ queue
- dictionary
- recursion and dynamic programming.
- Tree (Use Stack or Queue or recursive)
- Zero Sum ()
Time Complexity of finding the length of array or string in Python is O(1) not O(n).
Time complexity of copying a string is O(n**2) not O(n). (Generally, but can be different based on the programming language)
- Two Sum
- Binary Search
- Move Zeros
- Remove Elements