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

append_at(other: Self, at: usize) in O(n) time #19

Open
orxfun opened this issue Feb 28, 2024 · 1 comment
Open

append_at(other: Self, at: usize) in O(n) time #19

orxfun opened this issue Feb 28, 2024 · 1 comment

Comments

@orxfun
Copy link
Owner

orxfun commented Feb 28, 2024

This method can be implemented in O(n) time:

  • O(n) to find the position to append (at)
  • O(1) to append

It would reflect the recursive nature of the list.

@orxfun
Copy link
Owner Author

orxfun commented Mar 6, 2024

Now with NodeIndex made available, the following methods could also be implemented to execute in O(1):

  • append_next_to(&mut self, other: Self, node: NodeIndex)
  • append_prev_to(&mut self, other: Self, node: NodeIndex)

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

No branches or pull requests

1 participant