You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/website/contents/algorithms/binary.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ toc_max_heading_level: 2
21
21
22
22
## Introduction
23
23
24
-
Knowledge of binary number system and bit manipulation is less important in coding interviews as most Software Engineers do not have to deal with bits, which is more commonly used when dealing with lower level systems and programming languages. They are still asked sometimes, so you should at least still know how to convert a number from decimal form into binary form, and vice versa, in your chosen programming language.
24
+
Knowledge of binary number system and bit manipulation is less important in coding interviews as most Software Engineers do not have to deal with bits, which is more commonly used when dealing with lower level systems and programming languages. They are still asked sometimes, so you should at least still know how to convert a number from decimal form into binary form (and vice versa) in your chosen programming language.
Copy file name to clipboardExpand all lines: apps/website/contents/algorithms/graph.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ A graph is a structure containing a set of objects (nodes or vertices) where the
26
26
Graphs are commonly used to model relationship between unordered entities, such as
27
27
28
28
- Friendship between people - Each node is a person and edges between nodes represent that these two people are friends.
29
-
- Distances between locations - Each node is a location and the edge between nodes represent that these locations are connected. The value of the edge represent the distance.
29
+
- Distances between locations - Each node is a location and the edge between nodes represent that these locations are connected. The value of the edge represents the distance.
30
30
31
31
Be familiar with the various graph representations, graph search algorithms and their time and space complexities.
32
32
@@ -48,7 +48,7 @@ You can be given a list of edges and you have to build your own graph from the e
48
48
- Adjacency list
49
49
- Hash table of hash tables
50
50
51
-
Using a hash table of hash table would be the simplest approach during algorithm interviews. It will be rare that you have to use adjacency matrix or list for graph questions during interviews.
51
+
Using a hash table of hash tables would be the simplest approach during algorithm interviews. It will be rare that you have to use an adjacency matrix or list for graph questions during interviews.
52
52
53
53
In algorithm interviews, graphs are commonly given in the input as 2D matrices where cells are the nodes and each cell can traverse to its adjacent cells (up/down/left/right). Hence it is important that you be familiar with traversing a 2D matrix. When traversing the matrix, always ensure that your current position is within the boundary of the matrix and has not been visited before.
54
54
@@ -78,7 +78,7 @@ In algorithm interviews, graphs are commonly given in the input as 2D matrices w
-**Almost never** - Bellman-Ford algorithm, Floyd-Warshall algorithm, Prim's algorithm, Kruskal's algorithm. Your interviewer likely don't know them either.
81
+
-**Almost never** - Bellman-Ford algorithm, Floyd-Warshall algorithm, Prim's algorithm, Kruskal's algorithm. Your interviewer likely doesn't know them either.
82
82
83
83
### Depth-first search
84
84
@@ -161,7 +161,7 @@ For additional tips on BFS and DFS, you can refer to this [LeetCode post](https:
161
161
162
162
A topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering. Precisely, a topological sort is a graph traversal in which each node v is visited only after all its dependencies are visited.
163
163
164
-
Topological sorting is most commonly used for job scheduling a sequence of jobs or tasks which has dependencies on other jobs/tasks. The jobs are represented by vertices, and there is an edge from x to y if job x must be completed before job y can be started.
164
+
Topological sorting is most commonly used for scheduling a sequence of jobs or tasks which has dependencies on other jobs/tasks. The jobs are represented by vertices, and there is an edge from x to y if job x must be completed before job y can be started.
165
165
166
166
Another example is taking courses in university where courses have pre-requisites.
Copy file name to clipboardExpand all lines: apps/website/contents/algorithms/heap.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,8 @@ toc_max_heading_level: 2
23
23
24
24
A heap is a specialized tree-based data structure which is a complete tree that satisfies the heap property.
25
25
26
-
- Max heap - In a max heap the value of a node must be greatest among the node values in its entire subtree. The same property must be recursively true for all nodes in the tree.
27
-
- Min heap - In a min heap the value of a node must be smallest among the node values in its entire subtree. The same property must be recursively true for all nodes in the tree.
26
+
- Max heap - In a max heap, the value of a node must be greatest among the node values in its entire subtree. The same property must be recursively true for all nodes in the tree.
27
+
- Min heap - In a min heap, the value of a node must be smallest among the node values in its entire subtree. The same property must be recursively true for all nodes in the tree.
28
28
29
29
In the context of algorithm interviews, heaps and priority queues can be treated as the same data structure. A heap is a useful data structure when it is necessary to repeatedly remove the object with the highest (or lowest) priority, or when insertions need to be interspersed with removals of the root node.
Copy file name to clipboardExpand all lines: apps/website/contents/algorithms/math.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,13 @@ Math is a foundational aspect of Computer Science and every programmer and compu
29
29
- Check for and handle overflow/underflow if you are using a typed language like Java and C++. At the very least, mention that overflow/underflow is possible and ask whether you need to handle it.
30
30
- Consider negative numbers and floating point numbers. This may sound obvious, but under interview pressure, many obvious cases go unnoticed.
31
31
32
+
## Corner cases
33
+
34
+
- Division by 0
35
+
- Multiplication by 1
36
+
- Negative numbers
37
+
- Floats
38
+
32
39
## Common formulas
33
40
34
41
|| Formula |
@@ -53,13 +60,6 @@ When dealing with floating point numbers, take note of rounding mistakes. Consid
53
60
54
61
If the question asks you to implement an operator such as power, square root or division and want it to be faster than O(n), some sort of doubling (fast exponentiation) or halving (binary search) is usually the approach to go. Examples: [Pow(x, n)](https://leetcode.com/problems/powx-n/), [Sqrt(x)](https://leetcode.com/problems/sqrtx/)
55
62
56
-
## Corner cases
57
-
58
-
- Division by 0
59
-
- Multiplication by 1
60
-
- Negative numbers
61
-
- Floats
62
-
63
63
## Essential questions
64
64
65
65
_These are essential questions to practice if you're studying for this topic._
Copy file name to clipboardExpand all lines: apps/website/contents/algorithms/queue.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ Breadth-first search is commonly implemented using queues.
55
55
56
56
## Things to look out for during interviews
57
57
58
-
Most languages don't have a builtin Queue class which to be used, and candidates often use arrays (JavaScript) or lists (Python) as a queue. However, note that the enqueue operation in such a scenario will be O(n) because it requires shifting of all other elements by one. In such cases, you can flag this to the interviewer and say that you assume that there's a queue data structure to use which has an efficient enqueue operation.
58
+
Most languages don't have a built-in Queue class which can be used, and candidates often use arrays (JavaScript) or lists (Python) as a queue. However, note that the enqueue operation in such a scenario will be O(n) because it requires shifting of all other elements by one. In such cases, you can flag this to the interviewer and say that you assume that there's a queue data structure to use which has an efficient enqueue operation.
0 commit comments