mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Fix word typos in comments (#4928)
* fixed: spelling nonegative -> non-negative * fixed: spelling transpostiion -> transposition * fixed: spelling topolical -> topological * fixed: spelling sufix -> suffix
This commit is contained in:
parent
d530d2bcf4
commit
90db98304e
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Bead sort only works for sequences of nonegative integers.
|
||||
Bead sort only works for sequences of non-negative integers.
|
||||
https://en.wikipedia.org/wiki/Bead_sort
|
||||
"""
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Source: https://en.wikipedia.org/wiki/Odd%E2%80%93even_sort
|
||||
|
||||
This is a non-parallelized implementation of odd-even transpostiion sort.
|
||||
This is a non-parallelized implementation of odd-even transposition sort.
|
||||
|
||||
Normally the swaps in each set happen simultaneously, without that the algorithm
|
||||
is no better than bubble sort.
|
||||
|
|
|
@ -10,7 +10,7 @@ vertices = ["a", "b", "c", "d", "e"]
|
|||
|
||||
|
||||
def topological_sort(start, visited, sort):
|
||||
"""Perform topolical sort on a directed acyclic graph."""
|
||||
"""Perform topological sort on a directed acyclic graph."""
|
||||
current = start
|
||||
# add current to visited
|
||||
visited.append(current)
|
||||
|
|
|
@ -14,7 +14,7 @@ Time Complexity: O(n) - where n is the length of the string
|
|||
def prefix_function(input_string: str) -> list:
|
||||
"""
|
||||
For the given string this function computes value for each index(i),
|
||||
which represents the longest coincidence of prefix and sufix
|
||||
which represents the longest coincidence of prefix and suffix
|
||||
for given substring (input_str[0...i])
|
||||
|
||||
For the value of the first element the algorithm always returns 0
|
||||
|
@ -45,7 +45,7 @@ def prefix_function(input_string: str) -> list:
|
|||
def longest_prefix(input_str: str) -> int:
|
||||
"""
|
||||
Prefix-function use case
|
||||
Finding longest prefix which is sufix as well
|
||||
Finding longest prefix which is suffix as well
|
||||
|
||||
>>> longest_prefix("aabcdaabc")
|
||||
4
|
||||
|
|
Loading…
Reference in New Issue
Block a user