Data Structure | Add/Insert | Remove/Delete | Access/Get | Search/Contains | Space Complexity |
---|---|---|---|---|---|
Array | O(n) |
O(n) |
O(1) |
O(n) |
O(n) |
Set | O(logn) |
O(logn) |
- |
O(logn) |
O(n) |
Unordered Set | O(1)Average O(n)Worst |
O(1)Average O(n)Worst |
- |
O(1)Average O(n)Worst |
O(n) |
Map | O(logn) |
O(logn) |
- |
O(logn) |
O(n) |
Unordered Map | O(1)Average O(n)Worst |
O(1)Average O(n)Worst |
- |
O(1)Average O(n)Worst |
O(n) |
Singly LinkedList | O(1) |
O(1) |
O(n) |
O(n) |
O(n) |
Doubly LinkedList | O(1) |
O(1) |
O(n) |
O(n) |
O(n) |
Circular Singly LinkedList | O(1) |
O(1) |
O(n) |
O(n) |
O(n) |
Circular Doubly LinkedList | O(1) |
O(1) |
O(n) |
O(n) |
O(n) |
Stack | O(1) |
O(1) |
O(n) |
O(n) |
O(n) |
Queue | O(1) |
O(1) |
O(n) |
O(n) |
O(n) |
HashMap | O(1) |
O(1) |
O(1) |
O(1) |
O(n) |
Binary Search Tree | O(log n) |
O(log n) |
O(log n) |
O(log n) |
O(n) |
Binary Min Heap | O(log n) |
O(log n) |
O(1) |
O(n) |
O(n) |
Binary Max Heap | O(log n) |
O(log n) |
O(1) |
O(n) |
O(n) |
Problem | Topic | Question link | Solution | my article/article from discussion tab |
---|---|---|---|---|
longest substring without repeating characters | sliding window | link | link | |
minimum window substring | sliding window | link | link | link |
maximum consecutive ones 3 | sliding window | link | link | |
longest repeating character replacement | sliding window | link | link | |
Subarrays with K Different Integers | sliding window | link | link | link |
longest substring with at most k distinct characters | sliding window | leetcode premium | link | link |
longest subarray with difference less than limit | sliding window | link | link | link |
Problem | Topic | Question link | Solution |
---|---|---|---|
link | link |
Problem | Topic | Question link | Solution |
---|---|---|---|
maximum product subarray | kadane's algo | link | link |
sort colors | dnf sort | link | link |
minimum days to make m bouquets | binary search | link | link |
Problem | Topic | Question link | Solution |
---|---|---|---|
odd even linked list | linked list | link | link |
3 Sum | two pointers | link | link |
- revised other topics
Problem | Topic | Question link | Solution |
---|---|---|---|
single number | bit manipulation | link | link |
majority element | arrays | link | link |
container with most water | two pointers | link | link |
house robber | arrays | link | link |
Problem | Topic | Question link | Solution |
---|---|---|---|
longest subarray with difference less than limit | sliding window | link | link |
longest substring with at most k distinct characters | sliding window | leetcode premium | link |
Subarrays with K Different Integers | sliding window | link | link |
- and revised some topics
Problem | Topic | Question link | Solution |
---|---|---|---|
longest substring without repeating characters | sliding window | link | link |
minimum window substring | sliding window | link | link |
maximum consecutive ones 3 | sliding window | link | link |
longest repeating character replacement | sliding window | link | link |
- prim's algorithm for minimum spanning tree - brute force
- prim's a;gorithm for minimum spanning tree - optimized
- learnt about heaps and priority queues
- detect a cycle in directed graph using DFS
- topological sort using DFS
- topological sort using BFS - kahn's algorithm
- detect a cycle in directed graph using BFS - kahn's algo
- bipartite graph using bfs
- bipartite graph using dfs
- detect a cycle in undirected graph using bfs
- detect a cycle in undirected graph using dfs
1. continued learning graphs. Learnt about traversal techniques (bfs, dfs), connected components etc.
- binary tree to BST
- check whether BST contain dead end
- find closest element in BST
- lowest common ancestor of BST
- smaller on right
- brothers from different roots
- find a pair with given target in BST
- find common nodes in two BSTs
- vertical sum
- vertical traversal of binary tree
- top view of binary tree
- bottom view of binary tree
- check for BST
- count BST nodes that lie in a given range
- fixing two nodes of BST
- kth largest element in BST
- kth smallest element in BST
- populate inorder successor of all nodes
- predecessor and successor
- sum of the longest bloodline of a tree
- check if tree is isomorphic
- level of a node of binary tree
- minimum distance between two given nodes
- burning tree
- node at a given distance
- construct a binary tree from inorder and preorder
- serialize and deserialize binary tree
2. solved lowest common ancestor problem
- Revised Binary Trees
- appeared for desis ascend educare coding round
- codeforces educational round 113 problem B
- binary tree to doubly linked list
- check if binary tree is sum tree
- leaf at same level
- codeforces educational round 113 problem A
- diameter of binary tree
- left view of binary tree
- right view of binary tree
- zigzag traversal
- check if the tree is balanced or not
- preorder indorder postorder all in one traversal
- level order traversal
- reverse level order traversal
- iterative inorder traversal
- iterative preorder traversal
- iterative postorder traversal using 1 stack
- iterative postorder traversal using 2 stacks
- height of binary tree
- maximum and minimum of binary tree
- circular tour
- first negative integer in every window of size k
- generate binary numbers
- queue using two stacks
- reverse first k elements of queue
- maximum of all subarrays of size k
- Implement queue using arrays
- Implement queue using circular arrays
- Implement queue using linked list
- Implement queue using queue in stl
- stock span problem
- implement k stacks in a single array
- next greater element
- maximum rectangular area of histogram
- special stack
- delete middle element of the stack
- Reverse a string using stacks
- Parenthesis checker
- Evaluation of Postfix expression
- Implementation of two stacks in an array
- count total set bits for number 1 to n
- non repeating numbers
- bit difference
- number of 1 bits
- bit manipulation
- clone linked list with next and random pointer
- delete without head pointer
- pairwise swap of nodes of linked list
- Intersection Point in Y Shapped Linked Lists
- Check If Circular Linked List
- Split a Circular Linked List into two halves
- Check if Linked List is Palindrome
- Given a linked list of 0s, 1s and 2s, sort it
- Segregate even and odd nodes in a Link List
- multiply two linked lists
- delete nodes having greater value on its right
- rotate a linked list
- add two numbers represented by linked lists
- remove duplicates from unsorted linked list
- add 1 to number represnted by linked list
- intersection of two sorted linked lists
- delete kth node from circular linked list
- detect a loop
- length of the loop
- remove a loop
- remove duplicates from sorted list
- reverse a doubly linked list
1. Covered Basic functions of doubly linked list
2. Covered Basic functions of circular linked list
- Reverse a linked list
- Reverse linked list in groups of given size
- Nth node from end of linked list
- Remove duplicates from sorted linked list
- Middle element of linked list
- Basic functions of doubly linked list
- keypad combination
- get stair paths
- Some previous contest questions
- Median of row wise sorted Matrix
- Find Safe Position
- And Some basic recursion problems from Pepcoding
- Rotate image
- Spiral traversal of a matrix
- Search an element in the matrix
- Find row with maximum number of 1s
- Print elements in sorted order using row-column wise sorted matrix
- boolen matrix problem
- make matrix beautiful
- Added following under math tricks folder:
- XxOoRr from Codechef July Long Challenge (will upload here as the contest gets over)
- Odd set from Codeforces round #729
- Upsolved plus and multiply Codeforces round #729
- longest subarray with sum divisible by k
- Smallest Distinct Window
- Count distinct elements in every window
- Smallest window in a string containing all the characters of another string
- Second most repeated string in a subsequence
- array subset of another array
- longest consecutive subsequence
- longest subarray of 0s and 1s
- longest subarray with sum k
- longest span in two binary arrays
- longest consecutive subsequence
- Cyclic quadrilateral
- chess match
- total correct submissions
- chef and queries
- Union of two arrays
- Intersection of two arrays
- count pairs with given sum
- subarray with sum 0
- subarray with given sum
- array manipulation
3. Appended Math Tricks folder by adding "Recurring Decimal"
- Minimum number of days to make m bouquets
- Common elements in three sorted arrays
- consecutive sum which ends up to a given number
- find pair difference
- first occurence using binary search
- last occurrence using binary search
- count occurrences
- square root
- number of 1s in a sorted array using binary search
- Bitwise tuples from june codechef long challenge (will post once the contest gets over)
- Merge Intervals
- Shortest route from june long challenge
- Bitwise Tuple from june long challenge
- Factorial of large numbers
- Length of longest substring
- Substring of length k with k-1 distinct elements
- Rotate a number
- Chocolate distribution problem
- Maximum sum of subarray less than or equal to x
- Subarray with given sum
- Count occurences of anograms
- Longest Subarray with atmost K Even elements
1. Solved 2 questions from codechef june long challenge (Couldn't post it here right now since contest is still on😅)
- Count Inversion
- Codeforces question B from today's contest