/avl_tree

Implementation of a set represented by the AVL tree

Primary LanguageC++MIT LicenseMIT

MIT License LinkedIn

Table of Contents
  1. About The Project
  2. Getting Started
  3. Example
  4. License
  5. Contact
  6. Acknowledgments

About The Project

This project is the AVL tree implementation functioning as a set. Inputs data from avlset.in file. Outputs result in avlset.out file. The format of the input is as follows:

  • N (number of operations) goes on the first line
  • Then N lines follow in the format X x Where X could be:
  • A - insert element into the set if it is not there
  • D - delete the element from the set if it is there
  • C - check the existence of an element in the set

x is of type int

The format of the output is as follows:

  • for each request C x, outputs Y (element is in the set) or N (element is not in the set)
  • outputs the balance of the root for each operation A x and D x

(back to top)

Getting Started

To see the set in action on your machine, follow the simple steps below.

Installation

  1. Clone the repo git clone https://github.com/MariaMozgunova/avl_tree.git
  2. Create avtset.in and avlset.out files in the same directory
  3. Run file avl_tree.cpp

(back to top)

Example

Example of the input file:

6
A 3
A 4
A 5
C 4
C 6
D 5

Example of the corresponding output file:

0
1
0
Y
N
-1

(back to top)

License

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

(back to top)

Contact

Maria Mozgunova - Twitter - @MariaMozgunova - mariiamozgunova@gmail.com

Project Link: https://github.com/MariaMozgunova/avl_tree

(back to top)

Acknowledgments

(back to top)