Skip to content

Commit 5dde6a0

Browse files
Fixed some invalid references and more spelling errors. (keon#786)
* Corrected spelling anf grammar errors in docstring for heap. * Fixed method signature for remove_min by removing unused parameter i. * Fixed grammar in min_child docstring. * Fixed spelling error. * Fixed spelling errors in matrix_exponentiation.py * Removed trailing semicolons in matrix_inversion.py. TODO: Check for possible type error in line 61. * Fixed spelling error in base_conversion.py. * Fixed incorrect reference in min_height.py * Fixed incorrect reference in max_height.py
1 parent 9b6b252 commit 5dde6a0

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

algorithms/linkedlist/linkedlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# in comparison, arrays require O(n) time to do the same thing.
44
# Linked lists can continue to expand without having to specify
55
# their size ahead of time (remember our lectures on Array sizing
6-
# form the Array Sequence section of the course!)
6+
# from the Array Sequence section of the course!)
77

88
# Cons
99
# To access an element in a linked list, you need to take O(k) time

algorithms/maths/base_conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def int_to_base(n, base):
3333

3434
def base_to_int(s, base):
3535
"""
36-
Note : You can use int() built-in function instread of this.
36+
Note : You can use int() built-in function instead of this.
3737
:type s: str
3838
:type base: int
3939
:rtype: int

algorithms/matrix/matrix_exponentiation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def multiply(matA: list, matB: list) -> list:
1616
def identity(n: int) -> list:
1717
"""
1818
Returns the Identity matrix of size n x n
19-
Time Complecity: O(n^2)
19+
Time Complexity: O(n^2)
2020
"""
2121
I = [[0 for i in range(n)] for j in range(n)]
2222

@@ -29,7 +29,7 @@ def matrix_exponentiation(mat: list, n: int) -> list:
2929
"""
3030
Calculates mat^n by repeated squaring
3131
Time Complexity: O(d^3 log(n))
32-
d: dimesion of the square matrix mat
32+
d: dimension of the square matrix mat
3333
n: power the matrix is raised to
3434
"""
3535
if n == 0:

algorithms/matrix/matrix_inversion.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ def invert_matrix(m):
2828
# Error conditions
2929
if not array_is_matrix(m):
3030
print("Invalid matrix: array is not a matrix")
31-
return [[-1]];
31+
return [[-1]]
3232
elif len(m) != len(m[0]):
3333
print("Invalid matrix: matrix is not square")
34-
return [[-2]];
34+
return [[-2]]
3535
elif len(m) < 2:
3636
print("Invalid matrix: matrix is too small")
37-
return [[-3]];
37+
return [[-3]]
3838
elif get_determinant(m) == 0:
3939
print("Invalid matrix: matrix is square, but singular (determinant = 0)")
40-
return [[-4]];
40+
return [[-4]]
4141

4242
# Calculation
4343
elif len(m) == 2:

algorithms/tree/max_height.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# iterative
1414

15-
from tree.tree import TreeNode
15+
from tree import TreeNode
1616

1717

1818
def max_height(root):

algorithms/tree/min_height.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from tree.tree import TreeNode
1+
from tree import TreeNode
22

33

44
def min_depth(self, root):

0 commit comments

Comments
 (0)