31-10-2012, 05:22 PM
Data Structure
Data Structure.pptx (Size: 146.21 KB / Downloads: 30)
What is Data Structure
Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.
It provide a means to manage huge amounts of data.
They are generally based on the ability of a computer to fetch and store data at any place in its memory, specified by an address.
The implementation of a data structure usually requires writing a set of procedures that create and manipulate instances of that structure.
Different kinds of data structures are suited to different kinds of applications.
Concept of Array and Pointer
Array
Array is a collection of same type elements under the same variable identifier referenced by index number.
It saves the memory space.
It helps to arrange the data items in particular order.
Searching is faster.
use one name for similar objects.
Can not be resize at runtime.
Pointer
A pointer is a variable which contains the address in memory of another variable.
Dynamic memory allocations
To return multiple value via functions.
Manipulation of data at their memory location is easier.
Two types of operator are use : & and *
& is give the memory address of variable
is give the value of variable
Concept of Linked List
Linear collection of class objects, called nodes
Connected by pointer links
Accessed via a pointer to the first node of the list
Subsequent nodes are accessed via the link-pointer member of the current node
Link pointer in the last node is set to null to mark the list’s end
You have an unpredictable number of data elements
Your list needs to be sorted quickly
Concept of Stack
Stacks are linear lists.
All deletions and insertions occur at one end of the stack known as the TOP.
Data going into the stack first, leaves out last.
Stacks are also known as LIFO data structures (Last-In, First-Out).
Bottom of stack indicated by a link member to NULL
Stacks structures are usually implemented using arrays or linked lists.
Similar to a pile of dishes
Tree traversals
Inorder traversal – prints the node values in ascending order
1. Traverse the left subtree with an inorder traversal
2. Process the value in the node (i.e., print the node value)
3. Traverse the right subtree with an inorder traversal
Preorder traversal
1. Process the value in the node
2. Traverse the left subtree with a preorder traversal
3. Traverse the right subtree with a preorder traversal
Postorder traversal
1. Traverse the left subtree with a postorder traversal
2. Traverse the right subtree with a postorder traversal
3. Process the value in the node