Create codespell.yml (#1698)

* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
This commit is contained in:
Christian Clauss
2020-01-18 13:24:33 +01:00
committed by GitHub
parent c01d178798
commit bfcb95b297
78 changed files with 206 additions and 188 deletions

View File

@ -15,7 +15,7 @@ class Node:
if self.left is None and self.right is None:
return str(self.value)
return pformat({"%s" % (self.value): (self.left, self.right)}, indent=1,)
return pformat({"%s" % (self.value): (self.left, self.right)}, indent=1)
class BinarySearchTree:

View File

@ -11,7 +11,7 @@ def swap(a, b):
return a, b
# creating sparse table which saves each nodes 2^ith parent
# creating sparse table which saves each nodes 2^i-th parent
def creatSparse(max_node, parent):
j = 1
while (1 << j) < max_node:

View File

@ -41,7 +41,7 @@ def binomial_coefficient(n: int, k: int) -> int:
def catalan_number(node_count: int) -> int:
"""
We can find Catalan number many ways but here we use Binomial Coefficent because it
We can find Catalan number many ways but here we use Binomial Coefficient because it
does the job in O(n)
return the Catalan number of n using 2nCn/(n+1).

View File

@ -12,7 +12,7 @@ class RedBlackTree:
less strict, so it will perform faster for writing/deleting nodes
and slower for reading in the average case, though, because they're
both balanced binary search trees, both will get the same asymptotic
perfomance.
performance.
To read more about them, https://en.wikipedia.org/wiki/Redblack_tree
Unless otherwise specified, all asymptotic runtimes are specified in
terms of the size of the tree.
@ -37,7 +37,7 @@ class RedBlackTree:
def rotate_left(self):
"""Rotate the subtree rooted at this node to the left and
returns the new root to this subtree.
Perfoming one rotation can be done in O(1).
Performing one rotation can be done in O(1).
"""
parent = self.parent
right = self.right
@ -656,7 +656,7 @@ def test_tree_traversal():
def test_tree_chaining():
"""Tests the three different tree chaning functions."""
"""Tests the three different tree chaining functions."""
tree = RedBlackTree(0)
tree = tree.insert(-16).insert(16).insert(8).insert(24).insert(20).insert(22)
if list(tree.inorder_traverse()) != [-16, 0, 8, 16, 20, 22, 24]:

View File

@ -21,7 +21,7 @@ class Node:
return f"'{self.value}: {self.prior:.5}'"
else:
return pformat(
{f"{self.value}: {self.prior:.5}": (self.left, self.right)}, indent=1,
{f"{self.value}: {self.prior:.5}": (self.left, self.right)}, indent=1
)
def __str__(self):
@ -161,7 +161,7 @@ def main():
"""After each command, program prints treap"""
root = None
print(
"enter numbers to creat a tree, + value to add value into treap, - value to erase all nodes with value. 'q' to quit. "
"enter numbers to create a tree, + value to add value into treap, - value to erase all nodes with value. 'q' to quit. "
)
args = input()