Skip to content

Commit 9dbec74

Browse files
authored
contents: grammar / consistency fixes for algo sites (#599)
1 parent 2666344 commit 9dbec74

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

apps/website/contents/algorithms/binary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ toc_max_heading_level: 2
2121

2222
## Introduction
2323

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.
2525

2626
## Learning resources
2727

apps/website/contents/algorithms/graph.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ A graph is a structure containing a set of objects (nodes or vertices) where the
2626
Graphs are commonly used to model relationship between unordered entities, such as
2727

2828
- 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.
3030

3131
Be familiar with the various graph representations, graph search algorithms and their time and space complexities.
3232

@@ -48,7 +48,7 @@ You can be given a list of edges and you have to build your own graph from the e
4848
- Adjacency list
4949
- Hash table of hash tables
5050

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.
5252

5353
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.
5454

@@ -78,7 +78,7 @@ In algorithm interviews, graphs are commonly given in the input as 2D matrices w
7878

7979
- **Common** - Breadth-first Search, Depth-first Search
8080
- **Uncommon** - Topological Sort, Dijkstra's algorithm
81-
- **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.
8282

8383
### Depth-first search
8484

@@ -161,7 +161,7 @@ For additional tips on BFS and DFS, you can refer to this [LeetCode post](https:
161161

162162
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.
163163

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.
165165

166166
Another example is taking courses in university where courses have pre-requisites.
167167

apps/website/contents/algorithms/heap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ toc_max_heading_level: 2
2323

2424
A heap is a specialized tree-based data structure which is a complete tree that satisfies the heap property.
2525

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.
2828

2929
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.
3030

apps/website/contents/algorithms/math.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ Math is a foundational aspect of Computer Science and every programmer and compu
2929
- 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.
3030
- Consider negative numbers and floating point numbers. This may sound obvious, but under interview pressure, many obvious cases go unnoticed.
3131

32+
## Corner cases
33+
34+
- Division by 0
35+
- Multiplication by 1
36+
- Negative numbers
37+
- Floats
38+
3239
## Common formulas
3340

3441
| | Formula |
@@ -53,13 +60,6 @@ When dealing with floating point numbers, take note of rounding mistakes. Consid
5360

5461
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/)
5562

56-
## Corner cases
57-
58-
- Division by 0
59-
- Multiplication by 1
60-
- Negative numbers
61-
- Floats
62-
6363
## Essential questions
6464

6565
_These are essential questions to practice if you're studying for this topic._

apps/website/contents/algorithms/queue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Breadth-first search is commonly implemented using queues.
5555

5656
## Things to look out for during interviews
5757

58-
Most languages don't have a built in 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.
5959

6060
## Corner cases
6161

apps/website/contents/algorithms/tree.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Trees are commonly used to represent hierarchical data, e.g. file systems, JSON,
5757

5858
### Binary tree
5959

60-
Binary means two, so nodes in a binary trees have a maximum of two children.
60+
Binary means two, so nodes in a binary tree have a maximum of two children.
6161

6262
**Binary tree terms**
6363

@@ -119,7 +119,7 @@ Be familiar with the following routines because many tree questions make use of
119119
- Whether a value is in the tree
120120
- Calculate height of the tree
121121
- Binary search tree
122-
- Determine if is binary search tree
122+
- Determine if it is a binary search tree
123123
- Get maximum value
124124
- Get minimum value
125125

apps/website/contents/algorithms/trie.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ Be familiar with implementing from scratch, a `Trie` class and its `add`, `remov
3737

3838
`m` is the length of the string used in the operation.
3939

40-
| Operation | Big-O | Note |
41-
| --------- | ----- | ---- |
42-
| Search | O(m) | |
43-
| Insert | O(m) | |
44-
| Remove | O(m) | |
40+
| Operation | Big-O |
41+
| --------- | ----- |
42+
| Search | O(m) |
43+
| Insert | O(m) |
44+
| Remove | O(m) |
4545

4646
## Corner cases
4747

0 commit comments

Comments
 (0)