Skip to content

Commit

Permalink
updated merge_sortpy and bubble_sort.py to resolve the formatting errors
Browse files Browse the repository at this point in the history
updated merge_sortpy and bubble_sort.py to resolve the formatting errors
  • Loading branch information
oleksandr-maksymikhin committed Jan 11, 2025
1 parent 037a58e commit 8abd65d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions solutions/bubble_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def bubble_sort(input_collection: list[T]) -> list[T]:
Sort elements in collection by swapping and moving larger elements to the end of collection.
Parameters:
input_collection: list[T], collection of unsorted data with data types (T): int, float, str, bool.
- input_collection: list[T], collection of unsorted data with data types (T): int, float, str, bool.
Returns -> list[T], collection of sorted elements with data types (T): int, float, str, bool.
Raises:
AssertionError: if input is not a collection.
AssertionError: if collection contains elements of different data types (non-homogeneous).
- AssertionError: if input is not a collection.
- AssertionError: if collection contains elements of different data types (non-homogeneous).
Examples:
>>> bubble_sort([1])
Expand Down
24 changes: 12 additions & 12 deletions solutions/merge_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def merge_sort(input_collection: list[T]) -> list[T]:
Sort elements in collection by splitting the collection in two parts and launch merge.
Parameters:
input_collection: list[T], collection of unsorted elements of data types (int, float, string, bool).
- input_collection: list[T], collection of unsorted elements of data types (int, float, string, bool).
Returns -> list[T], collection of sorted elements of data types (int, float, string, bool).
Raises:
AssertionError: if input is not a collection.
AssertionError: if input collection is empty.
AssertionError: if input is not a data type processed by module (int, float, string, bool).
AssertionError: if collection contains elements of different data types (non-homogeneous).
- AssertionError: if input is not a collection.
- AssertionError: if input collection is empty.
- AssertionError: if input is not a data type processed by module (int, float, string, bool).
- AssertionError: if collection contains elements of different data types (non-homogeneous).
Examples:
>>> merge_sort([1])
Expand Down Expand Up @@ -86,17 +86,17 @@ def merge(left: list[T], right: list[T]) -> list[T]:
Combine two sorted homogeneous collections into one sorted collection
Parameters:
left: list[T], first sorted collection of data types (int, float, string, bool).
right: list[T], second sorted collection of data types (int, float, string, bool).
- left: list[T], first sorted collection of data types (int, float, string, bool).
- right: list[T], second sorted collection of data types (int, float, string, bool).
Returns -> list[T], sorted collection of data types (int, float, string, bool).
Raises:
AssertionError: left is not a collection.
AssertionError: right is not a collection.
AssertionError: left collection contains elements of different data types (non-homogeneous).
AssertionError: right collection contains elements of different data types (non-homogeneous).
AssertionError: left and right contain elements of different data types(non-homogeneous).
- AssertionError: left is not a collection.
- AssertionError: right is not a collection.
- AssertionError: left collection contains elements of different data types (non-homogeneous).
- AssertionError: right collection contains elements of different data types (non-homogeneous).
- AssertionError: left and right contain elements of different data types(non-homogeneous).
Examples:
>>> merge([2], [1])
Expand Down

0 comments on commit 8abd65d

Please sign in to comment.