Skip to main content

Posts

Showing posts with the label data structure.

Types of Binary Tree

As we know binary tree is    special type of tree data structure used for data storage purposes. A binary tree has a special condition that each node can have a maximum of two children. There are many types of binary tree. following are common types of binary tree among them :-    i > Full or Strictly Binary Tree  ii > Complete Binary Tree. iii > Perfect Binary tree. iv > Balanced Binary Tree.   v > Skewed Binary Tree. i > Full or strictly Binary Tree :-  A Binary Tree is full if every node has 0 or 2 children. We can also say a full binary tree is a binary tree in which all nodes except leaves have two children. Full binary tree is also called as   Strictly binary tree .    ii > Complete Binary Tree :-  A Binary Tree is complete Binary Tree if all levels are completely filled except possibly the last level and  All the last level leaf nodes are as left as possible. iii > Perfect Binary tree :-   A Binary tree is Perfect Binary Tree in whi

Basic concept of Trees and its type In Data Structure

      ⇰ TREE :- Tree is one of the important non-liner data structure in computer science. Many real life problems can be represented and solved using trees. Trees are very flexible, versatile and powerful non-liner data structure that can be used to represent data items possessing hierarchical.        Other data structures such as arrays, linked list, stack, and queue are linear data structures that store data sequentially. In order to perform any operation in a linear data structure, the time complexity increases with the increase in the data size. But, it is not acceptable in today's computational world.  Different tree data structures allow quicker and easier access to the data as it is a non-linear data structure.   A tree is an ideal data structure for representing hierarchical data. A tree can be theoretically defined as a finite set of one or more nodes or data items such that :- i >  There is a special node called the root of the tree.  ii > All nodes are

linked list in Data Structure

                       LINKED LIST    A linked list is non-premitive data structure.  A  linked list  is a way to store a collection of elements. Like an array these can be character or integers. Each element in a linked list is stored in the form of a  node .   And a node is a collection of two sub-elements or parts , information or data part and another is address part .  A linked list is formed when many such nodes are linked together to form a chain. Each node points to the next node present in the order. The first node is always used as a reference to traverse the list and is called  Start or head and t he last node points to   NULL . Arrays can be used to store linear data of similar types, but arrays have some limitations as the size of the arrays is fixed: So we must know the upper limit on the number of elements in advance. Also, generally, the allocated memory is equal to the upper limit irrespective of the usage. Inserting a new element in an array of elem