Skip to content

WIP Enhance LinkedList with new methods - #33

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

vmasto wants to merge 1 commit into
Yomguithereal:masterfrom
vmasto:linked-list-enhance

Conversation

@vmasto

@vmasto vmasto commented Feb 14, 2017

Copy link
Copy Markdown

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

vmasto commented Feb 15, 2017

Copy link
Copy Markdown
Author

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

vmasto commented Feb 16, 2017

Copy link
Copy Markdown
Author

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.

This branch has not been deployed

No deployments
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