file_id.diz

来自「数据结构课程程序」· DIZ 代码 · 共 43 行

DIZ
43
字号
AVLtree v1.0
============

Open source code of an AVL tree using templates.
Every contribution, improvement and ideas are welcome.
If you do, distribute all this files:

        AVLtree.zip -> ZIP file with all the files:
                File_ID.diz -> This file
                AVLtree.hpp -> All the code (must be included)
		test_avl.cpp -> Test program, shows use of all functions
		test_avl.exe -> Program test_avl.cpp compiled

Credits:
        Programmed by Gerard Monells
        gerardmonells@hotmail.com

DOCUMENT
--------

Public functions:
	AVLtree() -> Creates an empty AVL tree [ex: AVLtree<string> a]
	AVLtree(AVLtree<T> a) -> Creates an AVL copy of a [ex: AVLtree<int> b(a)]
	operator=(AVLtree<T> a) -> returns a copy of a [ex: b = a OR b.operator=(a)]
	~AVLtree() -> Destructor method [cannot be called]
	add_item(T x) -> Adds x element to the tree, rotations included [ex: a.add_item(3)]
	search(T x) -> Returns TRUE if, and only if, tree contains x [ex: a.search(2)]
	size() -> Returns the number of elements stored [ex: a.size()]
	preorder() -> Makes a preorder of the tree [ex: a.preorder()]
	inorder() -> Makes a inorder of the tree [ex: a.inorder()]
	postorder() -> Makes a postorder of the tree [ex: a.postorder()]

Cost of the operations:
	AVLtree() -> O(1) -> Constant
	AVLtree(AVLtree<T> a) -> O(n) -> Linear
	operator=(AVLtree<T> a) -> O(n) -> Linear
	~AVLtree() -> O(n) -> Linear
	add_item(T x) -> O(log n) -> Logarithmic
	search(T x) -> O(log n) -> Logarithmic
	size() -> O(1) -> Constant
	preorder() -> O(n) -> Linear
	inorder() -> O(n) -> Linear
	postorder() -> O(n) -> Linear

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?