codezonediitj / pydatastructs

A python package for data structures and algorithms
https://pydatastructs.readthedocs.io/en/stable/
Other
202 stars 270 forks source link

implemented timsort #352

Closed sakshi2707 closed 3 years ago

sakshi2707 commented 3 years ago

References to other Issues or PRs or Relevant literature

Fixes #318

Brief description of what is fixed or changed

I have implemented timsort algorithm. This is based on insertion sort and merge sort algorithm, so i have added insertion sort algorithm also, which is used by timsort. Timsort is a stable sorting algorithm which requires O(n logn ) time.

Other comments

Smit-create commented 3 years ago

@sakshi2707 Are you participating in any program like GSSoC? Please mention that in your OP

sakshi2707 commented 3 years ago

@sakshi2707 Are you participating in any program like GSSoC? Please mention that in your OP

yes I'm a gssoc participant. Please provide gssoc label in issue

sakshi2707 commented 3 years ago

closes #318 @Smit-create I've made changes. please do check

sakshi2707 commented 3 years ago

@Smit-create I've made all the changes now. Please merge my PR . Thankyou.

Smit-create commented 3 years ago

Please merge my PR

You need to pass the CI tests for that.

czgdp1807 commented 3 years ago

TimSort is already implemented in Python internally. It would be better to implement its parallel version.

sakshi2707 commented 3 years ago

TimSort is already implemented in Python internally. It would be better to implement its parallel version.

You should have told this earlier then

czgdp1807 commented 3 years ago

No problem. Please let us know if you do not want to work on this further. A Please Take Over label will be attached so that someone else can take this over. Thanks.

P.S. Please do NOT close this PR.

sakshi2707 commented 3 years ago

Please merge my PR

You need to pass the CI tests for that.

ok sure

codecov[bot] commented 3 years ago

Codecov Report

Merging #352 (a06a06b) into master (48eb71a) will decrease coverage by 0.225%. The diff coverage is 70.370%.

@@              Coverage Diff              @@
##            master      #352       +/-   ##
=============================================
- Coverage   98.550%   98.325%   -0.226%     
=============================================
  Files           25        25               
  Lines         3243      3284       +41     
=============================================
+ Hits          3196      3229       +33     
- Misses          47        55        +8     
Impacted Files Coverage Δ
pydatastructs/linear_data_structures/__init__.py 100.000% <ø> (ø)
pydatastructs/linear_data_structures/algorithms.py 96.739% <70.370%> (-2.860%) :arrow_down:
...ucts/miscellaneous_data_structures/disjoint_set.py 100.000% <0.000%> (ø)

Impacted file tree graph

sakshi2707 commented 3 years ago

@Smit-create Now please merge my PR. Thankyou.

Smit-create commented 3 years ago

You haven't added any tests nor the documentation is up to the mark.

sakshi2707 commented 3 years ago

You haven't added any tests nor the documentation is up to the mark.

i have added in comments, please check it @Smit-create

Smit-create commented 3 years ago

Tests are meant to be in this file: https://github.com/codezonediitj/pydatastructs/blob/master/pydatastructs/linear_data_structures/tests/test_algorithms.py

sakshi2707 commented 3 years ago

@Smit-create I've added the tests in the respective folder as you asked Please merge my PR now. Thankyou

Smit-create commented 3 years ago

Please merge my PR now. Thankyou

Please have patience. I can only merge when your PR completely follows the code quality checks

sakshi2707 commented 3 years ago

If the size of the Array is less than run, then Array gets sorted just by using Insertion Sort. The size of the run may vary from 32 to 64 depending upon the size of the array. That's why we consider size of run as 32.

sakshi2707 commented 3 years ago

@Smit-create now review it please and add level label

czgdp1807 commented 3 years ago

Closing for now. If it will be a priority in future then we will take this feature into consideration. Thanks for contributing.