Skip to content

Commit f82f52d

Browse files
jaythoratczgdp1807
andauthored
Augmented bubble_sort API. (#442)
* Added bubble sort to documentation website * Added backend option to bubble_sort * Added Jay Thorat to AUTHORS in docs * Updated CI timeout-minutes Co-authored-by: Gagandeep Singh <gdp.1807@gmail.com>
1 parent 3ebfb83 commit f82f52d

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
test:
1111
runs-on: ${{matrix.os}}
12-
timeout-minutes: 5
12+
timeout-minutes: 10
1313
strategy:
1414
fail-fast: false
1515
matrix:

docs/source/authors.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ Prashant Rawat <prashant.rawat216@gmail.com>
2525
Harsheet <harsheetkakar@gmail.com>
2626

2727
Pratik Goyal <pratikgoyal2712@gmail.com>
28+
29+
Jay Thorat <j.thorat10@gmail.com>

docs/source/pydatastructs/linear_data_structures/algorithms.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Algorithms
1919

2020
.. autofunction:: pydatastructs.quick_sort
2121

22+
.. autofunction:: pydatastructs.bubble_sort
23+
2224
.. autofunction:: pydatastructs.longest_common_subsequence
2325

2426
.. autofunction:: pydatastructs.is_ordered

pydatastructs/linear_data_structures/algorithms.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,10 @@ def bubble_sort(array, **kwargs):
13261326
Optional, by default, less than or
13271327
equal to is used for comparing two
13281328
values.
1329+
backend: pydatastructs.Backend
1330+
The backend to be used.
1331+
Optional, by default, the best available
1332+
backend is used.
13291333
13301334
Returns
13311335
=======
@@ -1350,6 +1354,8 @@ def bubble_sort(array, **kwargs):
13501354
13511355
.. [1] https://en.wikipedia.org/wiki/Bubble_sort
13521356
"""
1357+
raise_if_backend_is_not_python(
1358+
bubble_sort, kwargs.get('backend', Backend.PYTHON))
13531359
start = kwargs.get('start', 0)
13541360
end = kwargs.get('end', len(array) - 1)
13551361
comp = kwargs.get("comp", lambda u, v: u <= v)

pydatastructs/utils/tests/test_code_quality.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def _apis():
102102
pyds.LinkedListNode, pyds.BinomialTreeNode, pyds.AdjacencyListGraphNode,
103103
pyds.AdjacencyMatrixGraphNode, pyds.GraphEdge, pyds.Set, pyds.BinaryIndexedTree,
104104
pyds.CartesianTree, pyds.CartesianTreeNode, pyds.Treap, pyds.RedBlackTreeNode, pyds.RedBlackTree,
105-
pyds.Trie, pyds.TrieNode, pyds.SkipList, pyds.RangeQueryStatic, pyds.SparseTable]
105+
pyds.Trie, pyds.TrieNode, pyds.SkipList, pyds.RangeQueryStatic, pyds.SparseTable,
106+
pyds.bubble_sort]
106107

107108
def test_public_api():
108109
pyds = pydatastructs

0 commit comments

Comments
 (0)