Você está na página 1de 23

OUTLINE

What is mean by data structure?


Types of data structure Array

Stack
Queue Linked list

Tree
Graph

Data structure
A data structure is an arrangement of data in a computer's memory or even disk storage. It has a different way of storing and organizing data in a computer so that it can used efficiently.
Different kind of Data structure is used in different application. For example:

B-tree is widely used in implementation of databases.

Types of data structure


Linear Data Structure:

Linear data structure is linear if element is adjacent to each other. It has exactly two neighbors elements to which it is connected as its previous and next member.
Example of Linear Data structures: Array Linked List Stack Queue

Non- Linear Data Structure: Non-Linear data structure is that if one element can be connected to more than two adjacent element then it is known as non-linear data structure.
Example of Linear Data Structure: Tree Graph

Array:
An array is a data structure that contains a group of elements. Typically these elements are all of the same data type, such as an integer or string. Arrays are commonly used in computer programs to organize data so that a related set of values can be easily sorted or searched. For example a search engine may use an array to store Web pages.

Linked list:
A linked list is a data structure which consists of

data record in a sequence such that each data record have a field of data as well as link reference to its connected node. It do not provide the random access to any of its member data as it is form of a indexing and the connected node is pre-defined.
There are mainly three kinds of linked lists: Singly linked list Doubly linked list Circular linked list.

Singly link list: In the singly link list each node have two fields one for data and other is for link reference of the next node. The node have null only to the last node of the link field. This can be seen in the following picuture.

Doubly link list:

In the doubly link list each node have three field two fields for link which is the reference to next and previous and one for data record. The node have null only to the first node of previous and last node at the next. This can be seen in the following picture. Fig: Doubly Link List

Circular link list:

If talking about singly circular link list each node have two fields one for data record and other for link reference to the next node. The last node has link reference to the first node. There in no null present in the link of any node. Fig: Singly circular link list

Stack:

The stack is one of the most important data structures in computer science. A stack is a last-in first-out data structure (LIFO). action are performed by stack one is push and other is pop. The last thing which we placed or push on stack is the first thing we can get when we pop. A stack is a list of element with insertion and deletion at one end only.

Stack follows the rule of last in first out rule. Mainly two

Below depict the operational behaviors of stack. You can see

one thing that push and pop operation is done at one end and whatever element we keep on stack is shown at the top of stack.

Real time example for stack

Queue:
Queue is a linear data structure in which data can be added to one end and retrieved from the other. Just like the queue of the real world, the data that goes first

into the queue is the first one to be retrieved. That is why queues are sometimes called as First-In-FirstOut data structure. In case of queues, we saw that data is inserted both from one end but in case of Queues; data is added to one end (known as REAR) and retrieved from the other end (known as FRONT). The data first added is the first one to be retrieved while in case of queues the data last added is the first one to be retrieved.

A few points regarding Queues:


Queues: It is a linear data structure; linked lists and

arrays can represent it. Although representing queues with arrays have its shortcomings but due to simplicity, we will be representing queues with arrays in this article. Rear: A variable stores the index number in the array at which the new data will be added (in the queue). Front: It is a variable storing the index number in the array where the data will be retrieved.

Tree :

A tree is a data structure that is made of nodes and pointers, much like a linked list. The difference between them lies in how they are organized: The top node in the tree is called the root and all other nodes branch off from this one.
Every node in the tree can have some number of children. Each child node can in turn be the parent node to its children and so on.

Child nodes can have links only from a single parent. Any node higher up than the parent is called an ancestor node. Nodes having no children are called leaves. Any node which is neither a root, nor a leaf is called an interior node. The height of a tree is defined to be the length of the longest path from the root to a leaf in that tree ( including the path to root)

Graph:
Graphs are the data structures which are defined as of a set

of nodes and a set of edges that connect those nodes. Nodes in a graph are often called vertexes (sometimes vertexes are referred to as nodes or points). In graph theory, graphs are expressed as G = {E, V} where E is the finite set of edges and V is the finite set of vertexes. Graphs can be directed or undirected. Two vertexes a and b are called adjacent if (a,b) is an edge. A number of data structures can be chosen to represent a graph. The appropriate choice should be based on the problem definition and on the operation that should be applied to the edges and vertexes.

http://mystart.incredibar.com/mb117?a=6PQpgtfyg8&i= 26

Você também pode gostar