- Project description
- Interface description
- Description of classes
3.1. AVL
3.2. Node - Results of the program
The object of research is algorithms for sorting and searching AVL trees, as well as algorithms for optimal binary search and sorting by direct inclusion. The purpose of the course work is to develop an application for comparing and analyzing internal sorting algorithms.
Page interface model of sorting and search algorithms
The page interface model for working with the AVL tree
- page for demonstration of sorting and search;
- a page for demonstrating algorithms for the operation of AVL trees;
- table with characteristics of search algorithms;
- graph of the demonstration of the dependence of the time of the search algorithms on the number of elements;
- table with characteristics of sorting algorithms;
- graph demonstrating the dependence of the working time of sorting algorithms on the number of elements;
- array dimension input field;
- sort and search button;
- table showing the first 100 items after sorting;
- the button for adding a value to the AVL tree;
- value input field to add to the AVL tree;
- the button for deleting a value from the AVL tree;
- input field for deleting values from the AVL tree;
- the button for changing the value in the AVL tree;
- input field of the original value when changing in the AVL tree;
- the field for entering the final value when changing in the AVL tree;
- button for creating a new tree;
- the output field of the algorithm results;
- the output field of the AVL tree before making the names;
- the output field of the AVL tree after making changes.
AVL-tree entity class
-root: Node*
– root of the trees;
-count: int
– the number of elements in the tree at the moment;
-N: int
- the dimension of the tree.
+AVL()
– class constructor;
+AVL(int)
- class constructor;
+get_count()
- getting the value of the count field;
+set_N(int)
- change the value of the field N;
+add(int)
- adding an element to the tree (without obtaining characteristics);
+add(int, int&, int&)
- adding an element to the tree (with obtaining characteristics);
+remove(int, string&)
- removing an element from the tree;
+avl_looking(int, int*, bool&)
- search for the key (with saving the path to it);
+avl_search(int, double&)
- key search (without saving the path to it);
+left_to_right(int*, int)
- traversal from left to right;
+print_tree(TextBox)
- tree output;
-need_balance(Node*)
- checking the need for balancing;
-fix_height(Node*)
- restoring the height value;
-balance(Node*)
- balancing;
-LL(Node*)
– left turn;
-RR(Node*)
– right turn;
-in_order(Node*, int*, int, int&)
- recursive traversal.
AVL tree node class
-value: int
- the value in the node
-height: int
- height of the node
-left: Node*
– left subtree
-right: Node*
– right subtree
-parent: Node*
– parent element of the node
-same: int
– the number of elements with a repeating value
+Node(int)
- class constructor;
+Node(int, Node*)
- class constructor;
+get_value()
- getting the value of the value field;
+set_value(int)
- changing the value of the value field;
+get_ height()
- getting the value of the height field;
+set_ height(int)
- changing the value of the height field;
+get_ left()
- getting the value of the left field;
+set_ left Node*int)
- changing the value of the left field;
+get_ right()
- getting the value of the right field;
+set_right(Node*)
- changing the value of the right field;
+get_ parent()
- getting the value of the parent field;
+set_parent(Node*)
- changing the value of the parent field;
+get_same()
- getting the same field value;
+set_same(int)
- changing the value of the same field;