Saturday 14 October 2017

Introduction to Data Structure in Programming - Geeks4Coding

 Data Structure


   A data structure is an efficient way of organizing data so that it can be access, modify, search, delete or insert data in to a file using best possible time complexity algorithm. The basic idea of data structure is to reduce the space and time complexities of taken by a program to perform certain different tasks. Almost every enterprise application uses various types of data structures in one or the other way.

There are two different type of Data structure that are mainly used in almost every kind of problem. There are:

Linear Data Structure:

                In linear data structure the data is arranged sequentially i.e data is accessed or modified one after another. Below are some of the linear data structure.

Arrays: 

                   Array is a data structure used to group elements belong same data type at contiguous locations. Size of an array must be declared before storing data in to array. Learn more

Linked list: 

                   A linked list is a linear data structure like arrays where each element is a separate entity or a variable which comprises of two elements – the data to be store and a reference/link to the next node. And the memory of every node is allocated dynamically using malloc function in C language or new operator in C++ language. Learn more

 Stack:

                  A stack or LIFO (last in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: In stack both the operations of push and pop takes place at the same end that is top of the stack. It can be implemented by using both array and linked list. Learn more.


  • Push: Inserting element in to top of the stack. 
  • Pop: Removes the last element that was added or the element at the top both same.

Queue: 

                 A queue or FIFO (first in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: It can be implemented by using both array and linked list.
  • Enqueue: Adding an element to the from the rear side or back side.  
  • Dequeue: Removing the first element from the front side.


Non-Linear Data structure:

                A Non-Linear Data structure is a data structure in which a data item is connected to several other data items. So that a given data item has the possibility to reach one-or-more data items. Below are some of the Non-linear data structure.

Trees: 



               Tree is a hierarchical data structure. Main uses of trees include maintaining hierarchical data, providing moderate access and insert/delete operations. Binary trees are special cases of tree where every node has at most two children.

One reason to use trees might be because you want to store information that naturally forms a hierarchy. For example, the file system on a computer:

Trees provide moderate insertion/deletion (quicker than Arrays and slower than Unordered Linked Lists).

Graphs: 



               A Set of points known as nodes (or vertices) and set of links known as edges which connects the vertices. A graph is defined as follows...

Graph is a collection of Vertices/nodes and edges which connects nodes in the graph

Generally, a graph G is represented as G = ( V , E ), where V is set of vertices and E is set of edges.

No comments:

Post a Comment

Thank you for your Time. Keep Learning

Geeks4Coding

Contributors

Popular Posts