Skip to content
This repository has been archived by the owner. It is now read-only.

Lists & keys support #4

Open
fomkin opened this issue Jul 19, 2017 · 3 comments
Open

Lists & keys support #4

fomkin opened this issue Jul 19, 2017 · 3 comments
Assignees

Comments

@fomkin
Copy link
Owner

fomkin commented Jul 19, 2017

Levsha sucks when inserting (or prepending) nodes in container with big number of children.

@fomkin
Copy link
Owner Author

fomkin commented Jun 11, 2020

@fomkin
Copy link
Owner Author

fomkin commented Sep 2, 2021

Pseudo code

if key < old_key then
  node_insert_before(node, old_node)
  move_old_pointer_back()
else key > old_key then
  node_remove(old_node)
  move_current_pointer_back()
else 
  compare_nodes()

@fomkin
Copy link
Owner Author

fomkin commented Aug 10, 2022

val a = lhs.nextNode
val b = rhs.nextNode
val bb = rhs.nextNode

// 123 -> 0123
if a.key != b.key && a.key == bb.key then
  node_insert_before(a, b)
  rhs.back()
  rhs.back() 
// 1234 -> 134
else if a.key != b.key && a.key != bb.key then
  node_remove(a)
  rhs.back()
  rhs.back() 
else
  compare_nodes()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant