Professional Documents
Culture Documents
Assignment Data Structuer
Assignment Data Structuer
Assignment Data Structuer
2. Balancing Capabilities
One of the main concerns that computer science professionals have is to ensure that their trees are
balanced and with AVL trees, there is a higher likelihood of them being balanced. An unbalanced
tree means that it will take longer for operations to be performed, resulting in time intensive lookup
applications. The longer it takes for a tree to be balanced, the longer the search will take. Typically
referred to as a self balancing binary search tree, the three major operations you can complete with
an AVL tree include search, insert, and delete.
Advantages of BST :
Compared to linear search (checking each element in the array starting from the
first), binary search is much faster. Linear search takes, on average N/2
comparisons (where N is the number of elements in the array), and worst case N
comparisons. Binary search takes an average and worst-
case log2(N)log2(N) comparisons. So for a million elements, linear search
would take an average of 500,000 comparisons, whereas binary search would
take 20.
It’s a fairly simple algorithm, though people get it wrong all the time.
It’s well known and often implemented for you as a library routine.
Disadvantages of BST :
It’s more complicated than linear search, and is overkill for very small
numbers of elements.
It works only on lists that are sorted and kept sorted. That is not always
feasable, especially if elements are constantly being added to the list.
It works only on element types for which there exists a less-than
relationship. Some types simply cannot be sorted (though this is rare).
There is a great lost of efficiency if the list does not support random-access.
You need, for example, to immediately jump to the middle of the list. If your
list is a plain array, that’s great. If it’s a linked-list, not so much. Depending on
the cost of your comparison operation, the cost of traversing a non-random-
access list could dwarf the cost of the comparisons.
There are even faster search methods available, such as hash lookups.
However a hash lookup requires the elements to be organized in a much more
complicated data structure (a hash table, not a list).
ADVANTAGE OF B+ TREE :
B+ Trees are much easier and higher performing to do a full scan, since the terminal
nodes form a linked list. But to do a full scan in B tree, a complete inorder traversal is to
be made.
DISADVANTAGE OF B+ TREE :
Any search will end at leaf node only. Time complexity for every search results in O(h).
H-height of the B+ tree. Waste of Memory. In comparing to B+ trees, B trees are
efficient.
B-Tree advantage
B- Tree disadvantages
B-trees are powerful not just because they allow any file item to be
immediately located using any attribute as a key, but because they work even
when the file is very dynamic, with items constantly being inserted, changed, or
deleted.
But imagine a parts file where new items are infrequently added or changed
(say, once every few months) and rarely deleted. It may be tempting to use a B-
tree to allow instant lookup of a part number for a given description, but a B-
tree is probably overkill in this situation, since the data file being indexed rarely
changes.
Whenever a data file is relatively static and unchanging, it may be better to use
an indexing method simpler than B-trees, such as a minimum file of pointers
that is completely rebuilt any time the target data file is changed.
Advantages
AA TREES
Advantage of AA Trees
• AA trees simplify the algorithms – It eliminates half the restructuring cases – It simplifies
deletion by removing an annoying case
• if an internal node has only one child, that child must be a red right child
• We can always replace a node with the smallest child in the right subtree [it will either be a
leaf or have a red child]
HEAP
Advantage-
1-Help to find greatest and minimum number
2-Heap data structure efficiently use graph algorithm such as Dijkstra.
Disadvantage-
1-It takes so much time to compare and then execute.
Disadvantages-