Skip to content

danieljhegeman/2_3_tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2-3 Tree

Python interface for a 2-3 tree integer store, implemented in C.

Requirements

  • Python >= 3.0
  • GCC

Configuration

Generate shared object file

Build .so file:

python3 setup.py build

Locate the .so file that is generated, and move it up to the working directory:

mv build/lib.linux-x86_64-3.5/Tree.cpython-35m-x86_64-linux-gnu.so Tree.cpython-35m-x86_64-linux-gnu.so

Usage

Instantiate twoThreeTree object with optional array of initial integer values:

from twoThreeTree import twoThreeTree

myTree = twoThreeTree([1,2,3])

Check for presence of integers:

myTree.contains(1) # True
myTree.contains(0) # False

Insert additional single values:

myTree.insert(0) # True
myTree.contains(0) # True

Remove values:

myTree.remove(1) # True
myTree.contains(1) # False

Get number of leaves in tree:

myTree.count() # 3

See also:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published