Monday 2 December 2013

DATA STRUCTURES


             The word data is derived from Datum, which means fact. Hence data can be defined as the collection of raw facts. The difference between data and information is that information can be derived after processing the data. Thus we can define information as the processed data.

             To handle a collection of data items, it is better to select a structure and that structure can be called as Data Structure. It can be defined as “Collection of data elements organized in a specified manner and a set of functions to store, retrieve and manipulate the individual data elements”.

Various operations performed on the Data Structure:
  • INSERTION: is a process of adding an element or a set of elements to the Data Structure.
  • DELETION: is a process of removing the data elements from the given Data Structure.
  • TRAVERSING: is a process of visiting each & every data element at least once.
  • SORTING: is a process of arranging the given data elements in either ascending or descending order.
  • SEARCHING: is a process of finding a given element in a given Data Structure.
  • MERGING: operation combines two sorted Data Structures into a single Data Structure.
Representation of a Data Structure: There are 2 types of representation of Data Structure
  1. Sequential representation (using ARRAY’S) : in this elements are arranged sequentially in the memory. Hence arrays are suitable for this representation.
  2. Random Representation (using LINKED LIST’S): in this Data elements are arranged randomly in the memory.

    Classification of Data Structures:
    1. PRIMITIVE DATA STRUCTURES: are called as data types in programming languages.Ex: int , float, char and double.
    2. SIMPLE DATA STRUCTURES: these are normally constructed with the help of primitive Data Structures. These are also called as user defined Data Types (defined by the user).Ex: Array, structure, union, class and enumerated Data Type.
    3. COMPOUND DATA STRUCTURES: these can be constructed with the help of primitive and Simple Data Structures. These are of 2 types.
    1. Linear Data Structures: in the linear Data Structures the relationship of adjacency is maintained between the Data Items. Ex: STACKS, QUEUES and LINKED LIST’S
    2. Non-Linear Data Structure: in this Data Structures adjacency is not maintained between Data items. Ex: Trees and Graphs.
     

No comments:

Post a Comment

java binary tree program for inorder, preorder, postorder

import java.util.Queue; import java.util.LinkedList; public class TreeTraverse { private static class Node<T> { public Node<T> ...