Skip to content

WIP Enhance LinkedList with new methods#33

Open
vmasto wants to merge 1 commit intoYomguithereal:masterfrom
vmasto:linked-list-enhance
Open

WIP Enhance LinkedList with new methods#33
vmasto wants to merge 1 commit intoYomguithereal:masterfrom
vmasto:linked-list-enhance

Conversation

@vmasto
Copy link
Copy Markdown

@vmasto vmasto commented Feb 14, 2017

Hello! This PR aims to add a few more helpful methods in the Linked List implementation. If you so approve we could add more and once the API is finalized I'd be happy to implement a Doubly Linked List.

I'm aware of issue #18 but I'd need a few more details on what methods you'd like to be added.

Adds #find, #findLast, #addBefore, #addAfter
@Yomguithereal
Copy link
Copy Markdown
Owner

Hello @vmasto. Thanks for the PR. I think we need to change some things about the LinkedList before adding the move methods. I think we should make the internal node rely on some class like LinkedListNode instead of a plain object and make the push method return the instance of this class because else the move methods are O(n) rather than O(1) which is normally the real advantage of using a list rather than an array in memory. What do you think?

@vmasto
Copy link
Copy Markdown
Author

vmasto commented Feb 15, 2017

Makes sense to use LinkedListNode, however can we spec out the move methods?

@Yomguithereal
Copy link
Copy Markdown
Owner

Sure. Just ping me back if I forget.

@vmasto
Copy link
Copy Markdown
Author

vmasto commented Feb 16, 2017

Ping :D

@Yomguithereal
Copy link
Copy Markdown
Owner

I am still reflecting on how to change the API if we go the node class way. Because it might feel strange if some methods return a node and other ones don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants