Skip to content

Splay Tree with K-order statistics implementation

Notifications You must be signed in to change notification settings

panslava/splayTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

splayTree

Simple splay tree implementation with fast k-order statistics

Operations:

  • insert (key). Add new Node to tree by key. If Node with such key already exists — doesn't do anything
  • erase (key). Erase Node from tree by key. If Node with such key doesn't exists — doesn't do anything
  • exists (key). Returns true if Node with argument key exists in tree. Else returns false
  • next (key). Returns minimum Node with key > argument key. If no such Node — returns nullptr
  • prev (key). Returns maximum Node with key < argument key. If no such Node — returns nullptr
  • find_by_order (order). Returns Node by order. If order > size of tree — return nullptr
  • find_by_key (key). Finds and returns Node by key. If Node with such key doesn't exists — returns nullptr
  • size(). Returns size of the tree

All operations complexity: O(log n). Size operation complexity: O(1)

Todo:

  • iterators

Releases

No releases published

Packages

No packages published

Languages