Add doctests to radix_sort() (#2148) · kulinsky/Python@5b6ebf8 · GitHub
Skip to content

Commit 5b6ebf8

Browse files
cclaussgithub-actions
andauthored
Add doctests to radix_sort() (TheAlgorithms#2148)
* Add doctests to radix_sort() * fixup! Format Python code with psf/black push * Update radix_sort.py * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent f1ce2d6 commit 5b6ebf8

3 files changed

Lines changed: 33 additions & 25 deletions

File tree

DIRECTORY.md

Lines changed: 5 additions & 0 deletions

other/markov_chain.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55

66
class MarkovChainGraphUndirectedUnweighted:
7-
'''
7+
"""
88
Undirected Unweighted Graph for running Markov Chain Algorithm
9-
'''
9+
"""
1010

1111
def __init__(self):
1212
self.connections = {}
1313

1414
def add_node(self, node: str) -> None:
1515
self.connections[node] = {}
1616

17-
def add_transition_probability(self, node1: str,
18-
node2: str,
19-
probability: float) -> None:
17+
def add_transition_probability(
18+
self, node1: str, node2: str, probability: float
19+
) -> None:
2020
if node1 not in self.connections:
2121
self.add_node(node1)
2222
if node2 not in self.connections:
@@ -36,10 +36,10 @@ def transition(self, node: str) -> str:
3636
return dest
3737

3838

39-
def get_transitions(start: str,
40-
transitions: List[Tuple[str, str, float]],
41-
steps: int) -> Dict[str, int]:
42-
'''
39+
def get_transitions(
40+
start: str, transitions: List[Tuple[str, str, float]], steps: int
41+
) -> Dict[str, int]:
42+
"""
4343
Running Markov Chain algorithm and calculating the number of times each node is
4444
visited
4545
@@ -59,7 +59,7 @@ def get_transitions(start: str,
5959
6060
>>> result['a'] > result['b'] > result['c']
6161
True
62-
'''
62+
"""
6363

6464
graph = MarkovChainGraphUndirectedUnweighted()
6565

sorts/radix_sort.py

Lines changed: 18 additions & 15 deletions

0 commit comments

Comments
 (0)