From 82feea13f0351cad1813811f13ac13d4360839b8 Mon Sep 17 00:00:00 2001 From: Harshit Omer <20610736+omerharshit@users.noreply.github.com> Date: Sun, 28 Oct 2018 17:44:48 +0530 Subject: [PATCH] Time Analysis of AVL/ Height Balanced Tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Time Analysis Of AVL Tree: AVL tree is binary search tree with additional property that difference between height of left sub-tree and right sub-tree of any node can’t be more than 1. Algorithm Average Worst case Space O ( n ) {\displaystyle O(n)} O(n) O ( n ) {\displaystyle O(n)} O(n) Search O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) Insert O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) Delete O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) --- guide/english/algorithms/avl-trees/index.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guide/english/algorithms/avl-trees/index.md b/guide/english/algorithms/avl-trees/index.md index 897bf1a9204cca..98de8eaf934773 100644 --- a/guide/english/algorithms/avl-trees/index.md +++ b/guide/english/algorithms/avl-trees/index.md @@ -61,3 +61,14 @@ In RR Rotation every node moves one position to right from the current position. The LR Rotation is combination of single left rotation followed by single right rotation. In LR Rotation, first every node moves one position to left then one position to right from the current position. ->Right Left Rotation (RL Rotation) The RL Rotation is combination of single right rotation followed by single left rotation. In RL Rotation, first every node moves one position to right then one position to left from the current position. + +Time Analysis Of AVL Tree: + +AVL tree is binary search tree with additional property that difference between height of left sub-tree and right sub-tree of any node can’t be more than 1. + +Algorithm Average Worst case +Space O ( n ) {\displaystyle O(n)} O(n) O ( n ) {\displaystyle O(n)} O(n) +Search O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) +Insert O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) +Delete O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) O ( log ⁡ n ) {\displaystyle O(\log n)} O(\log n) +