Skip to content

spbu-coding-2023/trees-4

Repository files navigation

MIT License CodeFactor

About Tree Lib

Tree Lib is the kotlin library for working with 3 different binary tree implementations: Binary Search Tree (BST), AVL-Tree (AVL) and Red-Black Tree (RB).

How to use

To init an object, you must provide key and value type.

val treeExample: BSTree<<Key>, <Value>>

for example

val treeExample = BSTree<String, Double>()

All trees supports basic methods:

  • Add values and keys as nodes to the tree:

    treeExample.add(key: "abc", value: 1.0)

  • Change node's value:

    treeExample.changeVal(key: "abc", value: 37.7)

  • Remove node from the tree:

    treeExample.remove(key: "Choose wisely.")

  • Find node by key:

    treeExample.findByKey(key: "Anything you can compare!")

  • Iterate in tree:

    for (node in treeExample) { ...

  • ...and much more!

With binary trees, Tree Lib provides a node type for each of them. You can read node's key and value(with key() and value() methods), compare them between each other(although they must share same type), convert them to pair(toPair()) or string(toString()).

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

This library was created by:

  • Magomedov Islam (tg @JapEmpLove) - BST
  • Damir Yunusov (tg @TopographicOcean) - RB
  • Sofya Grishkova (tg @tea_jack) - AVL

Acknowledgments

README Template

Links to Wikipages about binary trees:

Here are provided applications, advantages and disadvantages of Binary Search Tree

Good Habr article about AVL-Trees

About

trees-4 created by GitHub Classroom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages