Skip to content

Added Longest Increasing Subsequence #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e882023
Added Longest Increasing Subsequence
tanyarajhans Feb 27, 2021
1cc929b
Added LIS
tanyarajhans Feb 27, 2021
1ee32a6
Updated test_algorithms.py
tanyarajhans Feb 27, 2021
1dd7734
Updated __init__.py
tanyarajhans Feb 27, 2021
63beb7f
Fixed errors
tanyarajhans Feb 27, 2021
a85ba89
Fixed errors
tanyarajhans Feb 27, 2021
5ca042f
Fixed errors
tanyarajhans Feb 27, 2021
9c88875
Fixed errors
tanyarajhans Feb 27, 2021
e153637
Fixed errors
tanyarajhans Feb 27, 2021
78c97d5
Fixed errors
tanyarajhans Feb 27, 2021
613c5aa
Fixed errors
tanyarajhans Feb 27, 2021
2be1290
Fixed errors
tanyarajhans Feb 27, 2021
e53706b
Fixed errors
tanyarajhans Feb 27, 2021
3ed9d54
Fixed errors
tanyarajhans Feb 27, 2021
bd7c943
Fixed errors
tanyarajhans Feb 27, 2021
cfc51d2
Fixed errors
tanyarajhans Feb 27, 2021
167fd7e
Fixed errors
tanyarajhans Feb 27, 2021
7a4c2bc
Fixed errors
tanyarajhans Feb 27, 2021
f3bc1d6
Fixed errors
tanyarajhans Feb 27, 2021
fa482ea
Fixed errors
tanyarajhans Feb 27, 2021
3ce0a31
Fixed errors
tanyarajhans Feb 27, 2021
9b28143
Fixed errors
tanyarajhans Feb 27, 2021
cb1f85c
Restored lines
tanyarajhans Feb 28, 2021
99066c5
Update algorithms.py
tanyarajhans Feb 28, 2021
86e0d84
NlogN approach for LIS
tanyarajhans Feb 28, 2021
6fdef7a
Indentation fixed
tanyarajhans Feb 28, 2021
2adf931
Update algorithms.py
tanyarajhans Feb 28, 2021
9fb7ba2
Update algorithms.py
tanyarajhans Feb 28, 2021
d5c40e1
Update algorithms.py
tanyarajhans Feb 28, 2021
09cf057
Update pydatastructs/utils/tests/test_code_quality.py
tanyarajhans Feb 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed errors
  • Loading branch information
tanyarajhans committed Feb 27, 2021
commit bd7c94386dde726abcf93f2f85a7b6929545d88a
7 changes: 3 additions & 4 deletions pydatastructs/linear_data_structures/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def bucket_sort(array: Array, **kwargs) -> Array:
if _check_type(array, DynamicArray):
array._modify(force=True)
return array

def cocktail_shaker_sort(array: Array, **kwargs) -> Array:
"""
Performs cocktail sort on the given array.
Expand Down Expand Up @@ -815,8 +815,7 @@ def longest_increasing_subsequence(seq: Array) -> int:
References
==========
.. [1] https://en.wikipedia.org/wiki/Longest_increasing_subsequence
Note


"""
n=len(seq)
lis=[1]*n
Expand All @@ -826,5 +825,5 @@ def longest_increasing_subsequence(seq: Array) -> int:
lis[i] = lis[j]+1
maximum=0
for i in range(n):
maximum = max(maximum, lis[i])
maximum = max(maximum, lis[i])
return maximum
2 changes: 1 addition & 1 deletion pydatastructs/utils/tests/test_code_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_trailing_white_spaces():
if line.endswith(" \n") or line.endswith("\t\n") \
or line.endswith(" ") or line.endswith("\t"):
assert False, "%s contains trailing whitespace at %s"\
%(file_path, line)
%(file_path, line)
line = file.readline()
file.close()

Expand Down