Skip to content

Just a Python implementation of AVL trees (having [key,values] nodes)

License

Notifications You must be signed in to change notification settings

ricardojrdez/avl-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

avl-tree

Just a Python 3.7 implementation of AVL trees. The implementation makes an extensive use of recursion.

The class AVLNode defines the content of a node of the AVL tree. In particular, you can have nodes with just a key or with a key and an associated value.

The class AVLTree defines an AVL tree structure and its common operations. Current operations supported:

  • Addition of a new node (requires a key and optionally, its associated value)
  • Removal of a given key
  • Visualization of an AVL tree (in pre-order, appending '-', '<', and '>' to indicate the level, left, and right child, respectively)
  • Three order traversals. Returns a string containing the order and (optionally) prints it to stdout
    • In-order traversal
    • Post-order traversal
    • Pre-order traversal
  • Maximum key value (returns the AVLNode)
  • Minimum key value (returns the AVLNode)
  • Search for a key
  • Existence of a key
  • Height of the AVL tree
  • Number of nodes in the AVL tree

License

Licensed under the MIT license.

About

Just a Python implementation of AVL trees (having [key,values] nodes)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages