CseWay

A Way For Learning

Showing posts with label Trees. Show all posts
Showing posts with label Trees. Show all posts

Tree & Ordered Tree

Tree is a non linear data structure in which every data item is attached to several other data items in a way that is specific for reflecting relationships. The data items are not arranged in a sequential structure.

A general tree does not follow any specific order at any level,the nodes are arranged randomly based the relationship.

In ordered tree,nodes are arranged in a specific order at each or certain levels, Eg: Binary Tree, Fibonacci Tree, Factorial Tree 

Graphs in Data Structures Intorduction

Java Program to Implement Self Balancing Binary Search Tree

/*
 *  Java Program to Implement Self Balancing Binary Search Tree

AVL insertion program

insertion, and deletion all take O(log n) time in both the average and worst cases, where n is the number of nodes in the tree prior to the operation. Insertions and deletions may require the tree to be rebalanced by one or more tree rotations. 

AVL deletion

// AvlTree class
//
// CONSTRUCTION: with no initializer