These are the summary of my learnings from an udemy course: "Data Structures & Algo in swift"
- Constant Time
- Linear Time
- Quadratic Time
- Logarithmic Time - Binary Search
- Quasilinear Time
- Root
- Child -> left child & right child
- Leaf
-
Elements are connected to each other by reference called Nodes
-
1st node in the linked list is called Head
-
Last node is called Tail node
Operations: - push - append - insert - pop - removeLast - remove
- Push
- Pop
- Peek
- Enqueue
- Dequeue
- Base case - which stops the recursion.
- Recursive case
- Depth First Traversal
- Level Order Traversal
- Search
- Binary Tree (can have max of: 2 Children only - left & right)
- In order Traversal -> leftChild -> Node -> RightChild
- Post order Traversal -> leftChild -> RightChild -> Node
- Pre order Traversal -> Node -> leftChild -> rightChild
- Binary Search Tree
- O(n)
- Sorted array
- Middle index - left or right
- Best Time: O(1)
- Worst Time: O(log n)
- Unsorted
- Best Time: O(n) (if already sorted)
- Worst Time: O(n^2)
- Swap the minimum element in the array with current index
- Move to next index and repeat step 1
- Best Time: O(n^2)
- Worst Time: O(n^2)
- Unsorted
- Best Time: O(n)
- Worst Time: O(n^2)
Consist of
- Vertices / Vertex
- Edges / Edge
- Weighted graphs
- Directed graphs
- Undirected graphs (bi-directional)
- Most commonly/widely used way to create and represent a graph