Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort
* Fixed doctest error due whitespace
* reduce loop times for optimization
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -13,10 +13,10 @@ def generate_all_permutations(sequence):
|
||||
|
||||
def create_state_space_tree(sequence, current_sequence, index, index_used):
|
||||
"""
|
||||
Creates a state space tree to iterate through each branch using DFS.
|
||||
We know that each state has exactly len(sequence) - index children.
|
||||
It terminates when it reaches the end of the given sequence.
|
||||
"""
|
||||
Creates a state space tree to iterate through each branch using DFS.
|
||||
We know that each state has exactly len(sequence) - index children.
|
||||
It terminates when it reaches the end of the given sequence.
|
||||
"""
|
||||
|
||||
if index == len(sequence):
|
||||
print(current_sequence)
|
||||
|
||||
Reference in New Issue
Block a user