Thursday, 6 November 2014

ABSTRACT DATA TYPES

What is meant by Abstract data type (ADT)?
  • Abstract Data Type (ADT) is a set of objects performing set of operations.
  • Here the implementations of operations are independent.
  • The operations performed on data are similar to mathematical operations.
Concept behind Abstract Data Type:
  • The implementation of operations written on one part of the program can be used from the other part of that same program just by calling the specific function.
  • If we want to make changes in the operation, it can be done easily by changing specific part of the function without disturbing rest of the program.
  • There is no general rule defining which operations must be handled by an ADT. Its completely up to the designers view.
  • Hence error handling and tie breaking can be easily handled by the programmer who designed.
Basic ADTs Most Used:
  • List ADT
  • Stack ADT
  • Queue ADT 
List ADT:
  • A list is a dynamic tuple of homogeneous elements with size n:
    A0,A1,A2,.....AN-1.
  • The position of element Ak is 'k'.Here the positions ranges from 0 to N-1.
  • We can also have empty list with size zero.
  • Operations performed: insert list, delete list, find kth element, find position of Ak, Print list, empty list.
  • Implementations: 1. Array implementation of list,
                                 2. Linked list implementation of list.
  • Applications: 1. Polynomial ADT,
                           2. Radix sort
Stack ADT:
  •  Stack is a list where insertion and deletion takes place only at one end called Top.
  • Basic idea behind stack is LIFO- Last In First Out . Hence stack lists are also called as LIFO lists.
  • Operations Performed:
    1. Push - inserting an element
    2. Pop- deleting an element
    3. Top- returning an element to the top of the stack.
    4. Empty- make the stack empty.
  • Implementations: 1. Array implementation of stack,
                                 2. Linked list implementation of stack.
  •  Applications: 1. Balancing Symbols
                            2. Postfix expressions, infix to postfix convertions
                            3. Function calls.
Queue ADT:
  • Queue is a list where insertion takes place at one end and deletion takes place at the other end.
  • Inserting end is rear and deleting end is front.
  • Basic idea behind stack is FIFO- First In First Out . Hence queue lists are also called as FIFO lists.
  • Operations Performed:
    1. Enqueue: Insertion
    2. Dequeue: Deletion
    3. Create Queue
    4, Dispose Queue
  • Implementations: Array implementation.
  • Applications: Graph theory.
Thus these are about What is Abstract Data Type? and the basic ADTs. We will see in detail about these ADTs in future posts.
Here is a Question for you....
           Is Linked list an ADT or is it a Data Structure??????????
Think over.....  For Answer search in my next post List ADT.









Tuesday, 4 November 2014

Data Structures Basics Tutorial

What is Data Stucture?
               Data Structure is nothing but a collection of information and manipulation of collected information.

What is Information?
               In Computer Science, information is the data that is specific,timely,used for a perform a task in the computer.The basic unit of information is bit having two values 0 or 1.0 represents 'OFF' Position and 1 represents 'ON' Position.

Why DataStructures are most important?
                DataStructures are most important because of the following three reasons:
1. DataStructures are more important for every program and system software.
2. Datastructures are most important for generating effecient algorithms enabling best management of     huge data collections such as integrated collection of database.
3. In software design, instead of algorithms Datastructures are used as key organising factor.

Applications:
In which areas Datastructures are applied?
             Usually datastructures are applied in the areas where large data are collected and manipulated. Some of those areas are:
1. Database Management System
2. Operating System
3. Statistical Analysis Package
4. Numerical Analysis
5. Graphics.

Different Types of Datastructures:
           We have large number of various forms of data structures. Among them the commonly used are:
1. Arrays: collection of elements having similar datatype.
2. Associative arrays: Also known as dictionary or map. Here name-value pair can be inserted or             deleted easily. Hash table datastructure is commonly implemented.
3. Record: Also known as tuple or struct.Record is a collection of sequentially arranged values that          are indexed with a fixed size.
4. Union: collection of values with various primitive types that can be stored at its instances.
5. Tagged Union: similar to union having  a current datatype as its additional field.
6. Set: Abstract Data Structure having collection of values that are not repeated and not in order.
7. Graphs: Linked Abstract Data Structure having nodes.Used to represent networks.
8.Trees: Linked Abstract Data Structure having nodes.Used in sorting and searching.  

Advantages of DataStructures:
1. Data Structures are the best way to handle huge data in a secured manner.
2. To make changes in hardware, we need to change its datastructure instead of their application.
3. Data structures are highly used for their effeciency and code reusability.

Disadvantages of DataStructures:
1. It is hard to make changes in large data structures.
2.Quite complex to solve problems in data structures.