Skip to content
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

Implemented Introsort #549

Merged
merged 10 commits into from
Dec 21, 2023
Merged

Implemented Introsort #549

merged 10 commits into from
Dec 21, 2023

Conversation

Kishan-Ved
Copy link
Contributor

References to other Issues or PRs or Relevant literature

Fixes #545

Brief description of what is fixed or changed

Implemented Introsort.

This was referenced Dec 20, 2023
Copy link

codecov bot commented Dec 20, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (1942891) 97.601% compared to head (13d4dfe) 97.552%.

Additional details and impacted files
@@              Coverage Diff              @@
##              main      #549       +/-   ##
=============================================
- Coverage   97.601%   97.552%   -0.050%     
=============================================
  Files           34        34               
  Lines         4295      4331       +36     
=============================================
+ Hits          4192      4225       +33     
- Misses         103       106        +3     
Files Coverage Δ
pydatastructs/linear_data_structures/__init__.py 100.000% <ø> (ø)
pydatastructs/linear_data_structures/algorithms.py 99.215% <91.666%> (-0.574%) ⬇️

Impacted file tree graph

Co-authored-by: ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) <[email protected]>
pydatastructs/linear_data_structures/algorithms.py Outdated Show resolved Hide resolved
pydatastructs/linear_data_structures/algorithms.py Outdated Show resolved Hide resolved
pydatastructs/linear_data_structures/algorithms.py Outdated Show resolved Hide resolved
pydatastructs/linear_data_structures/algorithms.py Outdated Show resolved Hide resolved
pydatastructs/linear_data_structures/algorithms.py Outdated Show resolved Hide resolved
pydatastructs/linear_data_structures/algorithms.py Outdated Show resolved Hide resolved
Co-authored-by: ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) <[email protected]>
return _algorithms.intro_sort(array, **kwargs)

# from pydatastructs import Stack
# Always sorts in increasing order
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is because of heapsort's limitation, right? Please mention here about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is because of the current heapsort function's limitation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I write that as a comment in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes made.

pydatastructs/linear_data_structures/algorithms.py Outdated Show resolved Hide resolved
@Kishan-Ved
Copy link
Contributor Author

I've done the mentioned changes: Added comment to code that a custom compactor cannot be taken due to heapsort's limitation.
I've also removed the commented statement of import stack.

Co-authored-by: ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) <[email protected]>
@Kishan-Ved
Copy link
Contributor Author

1 check didn't pass, I believe this is due to some backend issue.

=========================== short test summary info ============================
FAILED pydatastructs/utils/tests/test_code_quality.py::test_backend_argument_message - AssertionError: assert '<function intro_sort at 0x7f97b968adc0>' in 'As of 1.0.1-dev version, only Python backend is supported for <function next_permutation at 0x7f97b968a940> API'
 +  where '<function intro_sort at 0x7f97b968adc0>' = str(<function intro_sort at 0x7f97b968adc0>)
======= 1 failed, 160 passed, 2 xfailed, 7 xpassed in 138.76s (0:02:18) ========

@Kishan-Ved
Copy link
Contributor Author

All checks pass, the code suggested had next_permutation by mistake, which I changed to my function: intro_sort

@czgdp1807 czgdp1807 merged commit ec0b015 into codezonediitj:main Dec 21, 2023
8 checks passed
@Kishan-Ved
Copy link
Contributor Author

Thank you for your help! @czgdp1807
This is one of my first prominent open source code contributions! This helped me learn about reading, understanding and managing a large codebase. I'm delighted and eager to contribute more to this organization :)

Also please check the issue I faced, which I've mentioned here: #547 , along with the solution.

@Kishan-Ved Kishan-Ved deleted the intro_sort3 branch December 22, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement IntroSort
2 participants