Add doctests to radix_sort() by cclauss · Pull Request #2148 · TheAlgorithms/Python · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions DIRECTORY.md
20 changes: 10 additions & 10 deletions other/markov_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@


class MarkovChainGraphUndirectedUnweighted:
'''
"""
Undirected Unweighted Graph for running Markov Chain Algorithm
'''
"""

def __init__(self):
self.connections = {}

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

def add_transition_probability(self, node1: str,
node2: str,
probability: float) -> None:
def add_transition_probability(
self, node1: str, node2: str, probability: float
) -> None:
if node1 not in self.connections:
self.add_node(node1)
if node2 not in self.connections:
Expand All @@ -36,10 +36,10 @@ def transition(self, node: str) -> str:
return dest


def get_transitions(start: str,
transitions: List[Tuple[str, str, float]],
steps: int) -> Dict[str, int]:
'''
def get_transitions(
start: str, transitions: List[Tuple[str, str, float]], steps: int
) -> Dict[str, int]:
"""
Running Markov Chain algorithm and calculating the number of times each node is
visited

Expand All @@ -59,7 +59,7 @@ def get_transitions(start: str,

>>> result['a'] > result['b'] > result['c']
True
'''
"""

graph = MarkovChainGraphUndirectedUnweighted()

Expand Down
33 changes: 18 additions & 15 deletions sorts/radix_sort.py