Datastructure Free Tutorial
In computer science, a DataStructures is a particular way and organizing data in a computer so that it can be use efficiently.
A data structure is an arrangement of data in a computer memory or even disk storage.
An example of several common data structures are arrays, linked lists, queues, stacks, binary trees, and hash tables.Different kinds of DataStructures are suited to different kinds of applications and some are highly specialized to specific basis.
For example, 3-trees are particular well suited for implementation of databases, while compiler implementation usually use hash tables to look up identifiers.
DataStructures are used in almost every program or software system.
Specific DataStructures are essential ingredients of many efficient algorithms and make possible the management of huge amounts of data, such as large databases and internet indexing services.
The following are the two types of the DataStructures
Linear DataStructures.
Non-linear DataStructures.
The linear DataStructures holds /stores the data elements in the form of a linear list (i.e. in sequential)
Arrays, stacks, queues and linked lists are called linear DataStructures.
The non-linear DataStructures holds/stores the data elements in the form hierarchy by establishing some relationship between the data elements.
Trees and graphs are the nonlinear DataStructures.
Circular Queue
The Regular, static queues in data structures have a very big drawback, that once the queue is FULL, even though we delete few elements. From the front and relive some occupied space, we are not able to add anymore elements, as the rear has already reaches the queues rear most partition.
To overcome this drawback we can implement the queue as a circular queue. Here as we go on adding elements to the queue and reach the end of the array, the next element is stored in the first slot of the array (provide it is free).
Initially when such a circular queue is empty ,the Front and the rear values are-1 and -1 respectively; and the queue has a null value of all us element.
Every time we add on element to the queue the rear value increments by 1 till the time it reaches the upper limit of queue; after which it starts all over again from’0’
Similarly, every time we delete an element from queue, the front value increments by till the time it reaches the upper limit of queue. After which it starts all over again from ‘0’.
Stack Applications in Data Stuctures
A stack is useful in writing recursive calls.
A stack is useful to convert in fix expression into post fix expression.
It can be used in function calls for example, suppose that function a calls function b and passes two variables ,x and y to b. Then the function a can store these two variables on the stack, from where the function b can retrieve and use them.
A stack can be used to evaluate the postfix expression.
A+B=>AB+=>30.
A stack can be used to implement a calculator by storing the operands and the operators on the stack and using them as and when required.
The stack can be used in the algorithms which needs the back traversal.
For More Click on Link:
Very Nice Information... Worth sharing