matheusfrancisco / pydsx

Implementation about data structure and algorithms in python
1 stars 0 forks source link

[feat] Implement Sorting algorithms to singly linked list #8

Closed matheusfrancisco closed 10 months ago

matheusfrancisco commented 4 years ago

We need to sort our list so that we will implement our sorting algorithms

Aditya1001001 commented 4 years ago

I want to work on this issue, can you please assign it to me? It'll take me a couple of days to implement the algorithms, I'll make one PR for each, I'll try my best to write tests and docstrings for the functions. And you meant heapsort, didn't you?

matheusfrancisco commented 4 years ago

Thank you very much to help me implement theses algorithms.

It'll take me a couple of days to implement the algorithms, I'll make one PR for each, I'll try my best to write tests and docstrings for the functions.

R: Okay, no problem take your time. Thanks

And you meant heapsort, didn't you?

R: Yes, I meant heapsort

matheusfrancisco commented 4 years ago

I was thinking about the design of the algorithms what do you think.

if a person uses our list

sl = SinglyLinkedList ()
sl.append (1)
sl.append (2)
sl.append (3)
sl.sort(type='heapsort')
sl.sort(type="mergesort")
# by default use quicksort

or you think the best design is

new_singly_linked_list = heapsort(sl)

I thought of a sort method that would apply the sorting algorithm.

but I thought our abstractions must be in the future generic to singly linked list and doubly linked list but in the future we refactoring the code.

This is for us to discuss about algorithm design. Feel free to implement as you see fit, we are here to learn and discuss algorithms and data structure

Aditya1001001 commented 4 years ago
sl.sort(type='heapsort')
sl.sort(type="mergesort")

I'm working on implementing it like this, the only differences are that I named the argument method (type is a built-in method and that can cause issues), and the default sort algo is mergesort. I am also thinking about using a reverse argument to change the sorting order.

matheusfrancisco commented 4 years ago

@Aditya1001001 I mereged your last pull request. For the new pull request, run the make lint command before

Thankss!!

I will start try on documentation for this repository and doubly linked list and I will automate the deployment to pypi.org

for you to appear as a contributor to this lib you can put your email from pypi.org on pyproject.toml authors = ["matheusfrancisco matheusmachadoufsc@gmail.com", "user_from_pypi.org "]