Python Cheatsheet
❤5👍1
30-days learning plan to master Data Structures and Algorithms (DSA) and prepare for coding interviews.
### Week 1: Foundations and Basic Data Structures
Day 1-3: Arrays and Strings
- Topics to Cover:
- Array basics, operations (insertion, deletion, searching)
- String manipulation
- Two-pointer technique, sliding window technique
- Practice Problems:
- Two Sum
- Maximum Subarray
- Reverse a String
- Longest Substring Without Repeating Characters
Day 4-5: Linked Lists
- Topics to Cover:
- Singly linked list, doubly linked list, circular linked list
- Common operations (insertion, deletion, reversal)
- Practice Problems:
- Reverse a Linked List
- Merge Two Sorted Lists
- Remove Nth Node From End of List
Day 6-7: Stacks and Queues
- Topics to Cover:
- Stack operations (push, pop, top)
- Queue operations (enqueue, dequeue)
- Applications (expression evaluation, backtracking, breadth-first search)
- Practice Problems:
- Valid Parentheses
- Implement Stack using Queues
- Implement Queue using Stacks
### Week 2: Advanced Data Structures
Day 8-10: Trees
- Topics to Cover:
- Binary Trees, Binary Search Trees (BST)
- Tree traversal (preorder, inorder, postorder, level order)
- Practice Problems:
- Invert Binary Tree
- Validate Binary Search Tree
- Serialize and Deserialize Binary Tree
Day 11-13: Heaps and Priority Queues
- Topics to Cover:
- Binary heap (min-heap, max-heap)
- Heap operations (insert, delete, extract-min/max)
- Applications (heap sort, priority queues)
- Practice Problems:
- Kth Largest Element in an Array
- Top K Frequent Elements
- Find Median from Data Stream
Day 14: Hash Tables
- Topics to Cover:
- Hashing concept, hash functions, collision resolution (chaining, open addressing)
- Applications (caching, counting frequencies)
- Practice Problems:
- Two Sum (using hash map)
- Group Anagrams
- Subarray Sum Equals K
### Week 3: Algorithms
Day 15-17: Sorting and Searching Algorithms
- Topics to Cover:
- Sorting algorithms (quick sort, merge sort, bubble sort, insertion sort)
- Searching algorithms (binary search, linear search)
- Practice Problems:
- Merge Intervals
- Search in Rotated Sorted Array
- Sort Colors
- Find Peak Element
Day 18-20: Recursion and Backtracking
- Topics to Cover:
- Basic recursion, tail recursion
- Backtracking (N-Queens, Sudoku solver)
- Practice Problems:
- Permutations
- Combination Sum
- Subsets
- Word Search
Day 21: Divide and Conquer
- Topics to Cover:
- Basic concept, merge sort, quick sort, binary search
- Practice Problems:
- Median of Two Sorted Arrays
- Pow(x, n)
- Kth Largest Element in an Array (using divide and conquer)
- Maximum Subarray (using divide and conquer)
### Week 4: Graphs and Dynamic Programming
Day 22-24: Graphs
- Topics to Cover:
- Graph representations (adjacency list, adjacency matrix)
- Traversal algorithms (DFS, BFS)
- Shortest path algorithms (Dijkstra's, Bellman-Ford)
- Practice Problems:
- Number of Islands
Day 25-27: Dynamic Programming
- Topics to Cover:
- Basic concept, memoization, tabulation
- Common problems (knapsack, longest common subsequence)
- Practice Problems:
- Longest Increasing Subsequence
- Maximum Product Subarray
Day 28: Advanced Topics and Miscellaneous
- Topics to Cover:
- Bit manipulation
- Greedy algorithms
- Miscellaneous problems (trie, segment tree, disjoint set)
- Practice Problems:
- Single Number
- Decode Ways
- Minimum Spanning Tree
### Week 5: Review and Mock Interviews
Day 29: Review and Weakness Analysis
- Activities:
- Review topics you found difficult
- Revisit problems you struggled with
Day 30: Mock Interviews and Practice
- Activities:
- Conduct mock interviews with a friend or use online platforms
- Focus on communication and explaining your thought process
Top DSA resources to crack coding interview
👉 GeekforGeeks
👉 Leetcode
👉 DSA Steps
👉 FreeCodeCamp
👉 Coding Interviews
👉 Best DSA Resources
Join for more: https://t.iss.one/free4unow_backup
ENJOY LEARNING 👍👍
### Week 1: Foundations and Basic Data Structures
Day 1-3: Arrays and Strings
- Topics to Cover:
- Array basics, operations (insertion, deletion, searching)
- String manipulation
- Two-pointer technique, sliding window technique
- Practice Problems:
- Two Sum
- Maximum Subarray
- Reverse a String
- Longest Substring Without Repeating Characters
Day 4-5: Linked Lists
- Topics to Cover:
- Singly linked list, doubly linked list, circular linked list
- Common operations (insertion, deletion, reversal)
- Practice Problems:
- Reverse a Linked List
- Merge Two Sorted Lists
- Remove Nth Node From End of List
Day 6-7: Stacks and Queues
- Topics to Cover:
- Stack operations (push, pop, top)
- Queue operations (enqueue, dequeue)
- Applications (expression evaluation, backtracking, breadth-first search)
- Practice Problems:
- Valid Parentheses
- Implement Stack using Queues
- Implement Queue using Stacks
### Week 2: Advanced Data Structures
Day 8-10: Trees
- Topics to Cover:
- Binary Trees, Binary Search Trees (BST)
- Tree traversal (preorder, inorder, postorder, level order)
- Practice Problems:
- Invert Binary Tree
- Validate Binary Search Tree
- Serialize and Deserialize Binary Tree
Day 11-13: Heaps and Priority Queues
- Topics to Cover:
- Binary heap (min-heap, max-heap)
- Heap operations (insert, delete, extract-min/max)
- Applications (heap sort, priority queues)
- Practice Problems:
- Kth Largest Element in an Array
- Top K Frequent Elements
- Find Median from Data Stream
Day 14: Hash Tables
- Topics to Cover:
- Hashing concept, hash functions, collision resolution (chaining, open addressing)
- Applications (caching, counting frequencies)
- Practice Problems:
- Two Sum (using hash map)
- Group Anagrams
- Subarray Sum Equals K
### Week 3: Algorithms
Day 15-17: Sorting and Searching Algorithms
- Topics to Cover:
- Sorting algorithms (quick sort, merge sort, bubble sort, insertion sort)
- Searching algorithms (binary search, linear search)
- Practice Problems:
- Merge Intervals
- Search in Rotated Sorted Array
- Sort Colors
- Find Peak Element
Day 18-20: Recursion and Backtracking
- Topics to Cover:
- Basic recursion, tail recursion
- Backtracking (N-Queens, Sudoku solver)
- Practice Problems:
- Permutations
- Combination Sum
- Subsets
- Word Search
Day 21: Divide and Conquer
- Topics to Cover:
- Basic concept, merge sort, quick sort, binary search
- Practice Problems:
- Median of Two Sorted Arrays
- Pow(x, n)
- Kth Largest Element in an Array (using divide and conquer)
- Maximum Subarray (using divide and conquer)
### Week 4: Graphs and Dynamic Programming
Day 22-24: Graphs
- Topics to Cover:
- Graph representations (adjacency list, adjacency matrix)
- Traversal algorithms (DFS, BFS)
- Shortest path algorithms (Dijkstra's, Bellman-Ford)
- Practice Problems:
- Number of Islands
Day 25-27: Dynamic Programming
- Topics to Cover:
- Basic concept, memoization, tabulation
- Common problems (knapsack, longest common subsequence)
- Practice Problems:
- Longest Increasing Subsequence
- Maximum Product Subarray
Day 28: Advanced Topics and Miscellaneous
- Topics to Cover:
- Bit manipulation
- Greedy algorithms
- Miscellaneous problems (trie, segment tree, disjoint set)
- Practice Problems:
- Single Number
- Decode Ways
- Minimum Spanning Tree
### Week 5: Review and Mock Interviews
Day 29: Review and Weakness Analysis
- Activities:
- Review topics you found difficult
- Revisit problems you struggled with
Day 30: Mock Interviews and Practice
- Activities:
- Conduct mock interviews with a friend or use online platforms
- Focus on communication and explaining your thought process
Top DSA resources to crack coding interview
👉 GeekforGeeks
👉 Leetcode
👉 DSA Steps
👉 FreeCodeCamp
👉 Coding Interviews
👉 Best DSA Resources
Join for more: https://t.iss.one/free4unow_backup
ENJOY LEARNING 👍👍
❤2👍2
Python Important Star Patterns.
👍7
Useful Cheatsheets for Programmers
👇👇
Data Science Cheatsheet
https://github.com/aaronwangy/Data-Science-Cheatsheet
SQL Cheatsheet
https://learnsql.com/blog/sql-basics-cheat-sheet/
https://t.iss.one/programming_guide/299
https://www.sqltutorial.org/wp-content/uploads/2016/04/SQL-cheat-sheet.pdf
https://t.iss.one/learndataanalysis/442?single
Java Programming Cheatsheet
https://introcs.cs.princeton.edu/java/11cheatsheet/
PHP and Ruby Cheatsheets
https://t.iss.one/programming_guide/300
https://t.iss.one/programming_guide/301
Pandas in 5 minutes
https://bit.ly/3EZgNgF
Python Cheat sheet
https://t.iss.one/pythondevelopersindia/314
UML Cheat sheet
https://www.guru99.com/uml-cheatsheet-reference-guide.html.
GIT and Machine Learning Cheatsheet
https://t.iss.one/datasciencefun/714?single
Javascript Cheat sheet
https://t.iss.one/programming_guide/623
HTML Cheatsheet
https://web.stanford.edu/group/csp/cs21/htmlcheatsheet.pdf
ENJOY LEARNING 👍👍
👇👇
Data Science Cheatsheet
https://github.com/aaronwangy/Data-Science-Cheatsheet
SQL Cheatsheet
https://learnsql.com/blog/sql-basics-cheat-sheet/
https://t.iss.one/programming_guide/299
https://www.sqltutorial.org/wp-content/uploads/2016/04/SQL-cheat-sheet.pdf
https://t.iss.one/learndataanalysis/442?single
Java Programming Cheatsheet
https://introcs.cs.princeton.edu/java/11cheatsheet/
PHP and Ruby Cheatsheets
https://t.iss.one/programming_guide/300
https://t.iss.one/programming_guide/301
Pandas in 5 minutes
https://bit.ly/3EZgNgF
Python Cheat sheet
https://t.iss.one/pythondevelopersindia/314
UML Cheat sheet
https://www.guru99.com/uml-cheatsheet-reference-guide.html.
GIT and Machine Learning Cheatsheet
https://t.iss.one/datasciencefun/714?single
Javascript Cheat sheet
https://t.iss.one/programming_guide/623
HTML Cheatsheet
https://web.stanford.edu/group/csp/cs21/htmlcheatsheet.pdf
ENJOY LEARNING 👍👍
👍6
𝐃𝐚𝐭𝐚 𝐒𝐭𝐫𝐮𝐜𝐭𝐮𝐫𝐞𝐬 : 𝐄𝐱𝐩𝐥𝐨𝐫𝐞 𝐥𝐢𝐬𝐭𝐬, 𝐭𝐮𝐩𝐥𝐞𝐬, 𝐚𝐧𝐝 𝐝𝐢𝐜𝐭𝐢𝐨𝐧𝐚𝐫𝐢𝐞𝐬
𝐋𝐢𝐬𝐭𝐬:
- Lists are ordered collections of items.
- They are mutable, meaning you can change their content after creation.
- You can have duplicate values in a list.
- Lists are defined using square brackets [ ].
Example:
my_list = [1, 2, 3, 'apple', 'banana', 'cherry']
𝐓𝐮𝐩𝐥𝐞𝐬:
- Tuples are ordered collections of items, similar to lists.
- However, they are immutable, meaning once created, their content cannot be changed.
- Tuples are defined using parentheses ( ).
- You can have duplicate values in a tuple.
Example:
my_tuple = (1, 2, 3, 'apple', 'banana', 'cherry')
𝐃𝐢𝐜𝐭𝐢𝐨𝐧𝐚𝐫𝐢𝐞𝐬:
- Dictionaries are unordered collections of items that are stored as key-value pairs.
- They are mutable.
- Dictionaries are defined using curly braces { }.
- Each key in a dictionary must be unique, but the values can be duplicated.
Example:
my_dict = {'name': 'John', 'age': 30, 'city': 'New York'}
I have curated the best interview resources to crack Python Interviews 👇👇
https://topmate.io/coding/898340
Hope you'll like it
Like this post if you need more resources like this 👍❤️
- Lists are ordered collections of items.
- They are mutable, meaning you can change their content after creation.
- You can have duplicate values in a list.
- Lists are defined using square brackets [ ].
Example:
my_list = [1, 2, 3, 'apple', 'banana', 'cherry']
𝐓𝐮𝐩𝐥𝐞𝐬:
- Tuples are ordered collections of items, similar to lists.
- However, they are immutable, meaning once created, their content cannot be changed.
- Tuples are defined using parentheses ( ).
- You can have duplicate values in a tuple.
Example:
my_tuple = (1, 2, 3, 'apple', 'banana', 'cherry')
𝐃𝐢𝐜𝐭𝐢𝐨𝐧𝐚𝐫𝐢𝐞𝐬:
- Dictionaries are unordered collections of items that are stored as key-value pairs.
- They are mutable.
- Dictionaries are defined using curly braces { }.
- Each key in a dictionary must be unique, but the values can be duplicated.
Example:
my_dict = {'name': 'John', 'age': 30, 'city': 'New York'}
I have curated the best interview resources to crack Python Interviews 👇👇
https://topmate.io/coding/898340
Hope you'll like it
Like this post if you need more resources like this 👍❤️
❤5👍5👏1
DSA INTERVIEW QUESTIONS AND ANSWERS
1. What is the difference between file structure and storage structure?
The difference lies in the memory area accessed. Storage structure refers to the data structure in the memory of the computer system,
whereas file structure represents the storage structure in the auxiliary memory.
2. Are linked lists considered linear or non-linear Data Structures?
Linked lists are considered both linear and non-linear data structures depending upon the application they are used for. When used for
access strategies, it is considered as a linear data-structure. When used for data storage, it is considered a non-linear data structure.
3. How do you reference all of the elements in a one-dimension array?
All of the elements in a one-dimension array can be referenced using an indexed loop as the array subscript so that the counter runs
from 0 to the array size minus one.
4. What are dynamic Data Structures? Name a few.
They are collections of data in memory that expand and contract to grow or shrink in size as a program runs. This enables the programmer
to control exactly how much memory is to be utilized.Examples are the dynamic array, linked list, stack, queue, and heap.
5. What is a Dequeue?
It is a double-ended queue, or a data structure, where the elements can be inserted or deleted at both ends (FRONT and REAR).
6. What operations can be performed on queues?
enqueue() adds an element to the end of the queue
dequeue() removes an element from the front of the queue
init() is used for initializing the queue
isEmpty tests for whether or not the queue is empty
The front is used to get the value of the first data item but does not remove it
The rear is used to get the last item from a queue.
7. What is the merge sort? How does it work?
Merge sort is a divide-and-conquer algorithm for sorting the data. It works by merging and sorting adjacent data to create bigger sorted
lists, which are then merged recursively to form even bigger sorted lists until you have one single sorted list.
8.How does the Selection sort work?
Selection sort works by repeatedly picking the smallest number in ascending order from the list and placing it at the beginning. This process is repeated moving toward the end of the list or sorted subarray.
Scan all items and find the smallest. Switch over the position as the first item. Repeat the selection sort on the remaining N-1 items. We always iterate forward (i from 0 to N-1) and swap with the smallest element (always i).
Time complexity: best case O(n2); worst O(n2)
Space complexity: worst O(1)
9. What are the applications of graph Data Structure?
Transport grids where stations are represented as vertices and routes as the edges of the graph
Utility graphs of power or water, where vertices are connection points and edge the wires or pipes connecting them
Social network graphs to determine the flow of information and hotspots (edges and vertices)
Neural networks where vertices represent neurons and edge the synapses between them
10. What is an AVL tree?
An AVL (Adelson, Velskii, and Landi) tree is a height balancing binary search tree in which the difference of heights of the left
and right subtrees of any node is less than or equal to one. This controls the height of the binary search tree by not letting
it get skewed. This is used when working with a large data set, with continual pruning through insertion and deletion of data.
11. Differentiate NULL and VOID ?
Null is a value, whereas Void is a data type identifier
Null indicates an empty value for a variable, whereas void indicates pointers that have no initial size
Null means it never existed; Void means it existed but is not in effect
You can check these resources for Coding interview Preparation
Credits: https://t.iss.one/free4unow_backup
All the best 👍👍
1. What is the difference between file structure and storage structure?
The difference lies in the memory area accessed. Storage structure refers to the data structure in the memory of the computer system,
whereas file structure represents the storage structure in the auxiliary memory.
2. Are linked lists considered linear or non-linear Data Structures?
Linked lists are considered both linear and non-linear data structures depending upon the application they are used for. When used for
access strategies, it is considered as a linear data-structure. When used for data storage, it is considered a non-linear data structure.
3. How do you reference all of the elements in a one-dimension array?
All of the elements in a one-dimension array can be referenced using an indexed loop as the array subscript so that the counter runs
from 0 to the array size minus one.
4. What are dynamic Data Structures? Name a few.
They are collections of data in memory that expand and contract to grow or shrink in size as a program runs. This enables the programmer
to control exactly how much memory is to be utilized.Examples are the dynamic array, linked list, stack, queue, and heap.
5. What is a Dequeue?
It is a double-ended queue, or a data structure, where the elements can be inserted or deleted at both ends (FRONT and REAR).
6. What operations can be performed on queues?
enqueue() adds an element to the end of the queue
dequeue() removes an element from the front of the queue
init() is used for initializing the queue
isEmpty tests for whether or not the queue is empty
The front is used to get the value of the first data item but does not remove it
The rear is used to get the last item from a queue.
7. What is the merge sort? How does it work?
Merge sort is a divide-and-conquer algorithm for sorting the data. It works by merging and sorting adjacent data to create bigger sorted
lists, which are then merged recursively to form even bigger sorted lists until you have one single sorted list.
8.How does the Selection sort work?
Selection sort works by repeatedly picking the smallest number in ascending order from the list and placing it at the beginning. This process is repeated moving toward the end of the list or sorted subarray.
Scan all items and find the smallest. Switch over the position as the first item. Repeat the selection sort on the remaining N-1 items. We always iterate forward (i from 0 to N-1) and swap with the smallest element (always i).
Time complexity: best case O(n2); worst O(n2)
Space complexity: worst O(1)
9. What are the applications of graph Data Structure?
Transport grids where stations are represented as vertices and routes as the edges of the graph
Utility graphs of power or water, where vertices are connection points and edge the wires or pipes connecting them
Social network graphs to determine the flow of information and hotspots (edges and vertices)
Neural networks where vertices represent neurons and edge the synapses between them
10. What is an AVL tree?
An AVL (Adelson, Velskii, and Landi) tree is a height balancing binary search tree in which the difference of heights of the left
and right subtrees of any node is less than or equal to one. This controls the height of the binary search tree by not letting
it get skewed. This is used when working with a large data set, with continual pruning through insertion and deletion of data.
11. Differentiate NULL and VOID ?
Null is a value, whereas Void is a data type identifier
Null indicates an empty value for a variable, whereas void indicates pointers that have no initial size
Null means it never existed; Void means it existed but is not in effect
You can check these resources for Coding interview Preparation
Credits: https://t.iss.one/free4unow_backup
All the best 👍👍
👍5