Skip to content

Commit b484cca

Browse files
committed
Added example in SparseTable
1 parent d6f3beb commit b484cca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pydatastructs/miscellaneous_data_structures/sparse_table.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ class SparseTable(object):
3232
3333
`summation` - For range sum queries.
3434
35+
Examples
36+
========
37+
38+
>>> from pydatastructs import SparseTable, minimum
39+
>>> from pydatastructs import OneDimensionalArray
40+
>>> arr = OneDimensionalArray(int, [1, 2, 3, 4, 5])
41+
>>> s_t = SparseTable(arr, minimum)
42+
>>> str(s_t)
43+
"['[1, 1, 1]', '[2, 2, 2]', '[3, 3, None]', '[4, 4, None]', '[5, None, None]']"
44+
3545
References
3646
==========
3747

0 commit comments

Comments
 (0)