Data Structure
1.A data structure is a specialized format for organizing and storing data. Generaly data structure types include the array,the file .the reacord,table,the tree and soon.Any data structure is designed to orgsnized data suit a specific purpose so that it can be accessed and worked with in appropriate ways.In computer programming a data structure may be selected or designed to stored data for the purpose of working on it with various algorithm.
2. A data structure is a way of organizing information.Computre programs operate on data structore to solved problems.,much like a person uses a pencil and papre to solve problems,only quiter ther are many different ways of data structures.no one data structure is the best for every operation.each data structure works very well with some operation ,but poorly with other operations. Choosing the best data structure when solving a problem is important part of programming. Programs that used the right data structure are easier to make,and perform better.
3.Computer can stor and process vast amounts of data formal data structure enable a programmer to mentally structure large amount of data into conceptually manageable relationship.Sometimes we use data structure to allow us to do more for example:to accomplish fast searching or sort of data other wise, we use data structure so that wecan do less.for example:the concepts of stack is limited form of a general dara srtucture.These limitations provide us with guarantees allows us to reason about our programs more easily. Data structures also provide guarantees about algorithms complexity choosing an appropriate data structure for a job is crucial for writting good software.
4.Data structure are higher-level abstractions,they present to us operations on the group of data,such as adding an item to a list,or looking up the highedt priority item inn a queeue. When a data structure provides operations,we can call the data structure an abstract data type .
5.Data structure are used to organize and access variable data. A data structure contain a block of data divided into variables,they referred to us member variabled because theyre member og the data structure threat contained by .in its simplest form.A data structure is used to organize variables.
6.a means of storing collection of data.computer science is in part the studt of methods of an effectively using a computerr to solve problems .or in other word ,determining exactly the problem to be solved.
7.Data structure is the one-dimensional (linear)array ,in which stored elements are numbered with consecutive iontegers and contents are accessedby these numbers.
8.Data structure in computer science is a way of storing in a computer so that it can be used efficienly.it is an organization of mathematical & logical concepts of data.
9.Set og structural meta data associated to a data set,which include information about how concepts are allociated with the measures,dimensions.and attributes of an data cude,along with information about the representation of data and related description meta data.
10.Data structure is a way of arranging information in the memory ogf a computer.in computer programming,it is often necessary to solve large number of items in such manner as to reflect a relationships between them.
OTHER DATA STRUCTURES
I. STACK
In computer science, a stack is an abstract data type and data structure based on the principle of Last In First Out (LIFO). Stacks are used extensively at every level of a modern computer system. For example, a modern PC uses stacks at the architecture level, which are used in the basic design of an operating system for interrupt handling and operating system function calls. Among other uses, stacks are used to run a Java Virtual Machine, and the Java language itself has a class called "Stack", which can be used by the programmer. The stack is ubiquitous.
A stack-based computer system is one that stores temporary information primarily in stacks, rather than hardware CPU registers (a register-based computer system).
Basic architecture of a stack
A typical stack, storing local data and call information for nested procedures. This stack grows downward from its origin. The stack pointer points to the current topmost datum on the stack. A push operation decrements the pointer and copies the data to the stack; a pop operation copies data from the stack and then increments the pointer. Each procedure called in the program stores procedure return information (in yellow) and local data (in other colors) by pushing them onto the stack. This type of stack implementation is extremely common, but it is vulnerable to buffer overflow attacks (see the text).
A typical stack is an area of computer memory with a fixed origin and a variable size. Initially the size of the stack is zero. A stack pointer, usually in the form of a hardware register, points to the most recently referenced location on the stack; when the stack has a size of zero, the stack pointer points to the origin of the stack.
The two operations applicable to all stacks are:
* a push operation, in which a data item is placed at the location pointed to by the stack pointer, and the address in the stack pointer is adjusted by the size of the data item;
* a pop or pull operation: a data item at the current location pointed to by the stack pointer is removed, and the stack pointer is adjusted by the size of the data item.
There are many variations on the basic principle of stack operations. Every stack has a fixed location in memory at which it begins. As data items are added to the stack, the stack pointer is displaced to indicate the current extent of the stack, which expands away from the origin (either up or down, depending on the specific implementation).
For example, a stack might start at a memory location of one thousand, and expand towards lower addresses, in which case new data items are stored at locations ranging below 1000, and the stack pointer is decremented each time a new item is added. When an item is removed from the stack, the stack pointer is incremented.
Stack pointers may point to the origin of a stack or to a limited range of addresses either above or below the origin (depending on the direction in which the stack grows); however, the stack pointer cannot cross the origin of the stack. In other words, if the origin of the stack is at address 1000 and the stack grows downwards (towards addresses 999, 998, and so on), the stack pointer must never be incremented beyond 1000 (to 1001, 1002, etc.). If a pop operation on the stack causes the stack pointer to move past the origin of the stack, a stack underflow occurs. If a push operation causes the stack pointer to increment or decrement beyond the maximum extent of the stack, a stack overflow occurs.
Some environments that rely heavily on stacks may provide additional operations, for example:
* Dup(licate): the top item is popped and pushed again so that an additional copy of the former top item is now on top, with the original below it.
* Peek: the topmost item is popped, but the stack pointer is not changed, and the stack size does not change (meaning that the item remains on the stack). This is also called top operation in many articles.
* Swap or exchange: the two topmost items on the stack exchange places.
* Rotate: the n topmost items are moved on the stack in a rotating fashion. For example, if n=3, items 1, 2, and 3 on the stack are moved to positions 2, 3, and 1 on the stack, respectively. Many variants of this operation are possible, with the most common being called left rotate and right rotate.
Stacks are either visualized growing from the bottom up (like real-world stacks), or, with the top of the stack in a fixed position (see image), a coin holder ([1]) or growing from left to right, so that "topmost" becomes "rightmost". This visualization may be independent of the actual structure of the stack in memory. This means that a right rotate will move the first element to the third position, the second to the first and the third to the second. Here are two equivalent visualisations of this process:
apple banana
banana ==right rotate==> cucumber
cucumber apple
cucumber apple
banana ==left rotate==> cucumber
apple banana
A stack is usually represented in computers by a block of memory cells, with the "bottom" at a fixed location, and the stack pointer holding the address of the current "top" cell in the stack. The top and bottom terminology are used irrespective of whether the stack actually grows towards lower memory addresses or towards higher memory addresses.
Pushing an item on to the stack adjusts the stack pointer by the size of the item (either decrementing or incrementing, depending on the direction in which the stack grows in memory), pointing it to the next cell, and copies the new top item to the stack area. Depending again on the exact implementation, at the end of a push operation, the stack pointer may point to the next unused location in the stack, or it may point to the topmost item in the stack. If the stack points to the current topmost item, the stack pointer will be updated before a new item is pushed onto the stack; if it points to the next available location in the stack, it will be updated after the new item is pushed onto the stack.
Popping the stack is simply the inverse of pushing. The topmost item in the stack is removed and the stack pointer is updated, in the opposite order of that used in the push operation.
GRAPH
In computer science, a graph is a kind of data structure, specifically an abstract data type (ADT), that consists of a set of nodes (also called vertices) and a set of edges that establish relationships (connections) between the nodes. The graph ADT follows directly from the graph concept from mathematics.
Informally, G=(V,E) consists of vertices, the elements of V, which are connected by edges, the elements of E. Formally, a graph, G, is defined as an ordered pair, G=(V,E), where V is a set (usually finite) and E is a set consisting of two element subsets of V.
Choices of representation
Two main data structures for the representation of graphs are used in practice. The first is called an adjacency list, and is implemented by representing each node as a data structure that contains a list of all adjacent nodes. The second is an adjacency matrix, in which the rows and columns of a two-dimensional array represent source and destination vertices and entries in the array indicate whether an edge exists between the vertices. Adjacency lists are preferred for sparse graphs; otherwise, an adjacency matrix is a good choice. Finally, for very large graphs with some regularity in the placement of edges, a symbolic graph is a possible choice of representation.
Comparison with other data structures
Graph data structures are non-hierarchical and therefore suitable for data sets where the individual elements are interconnected in complex ways. For example, a computer network can be modeled with a graph.
Hierarchical data sets can be represented by a binary or nonbinary tree. It is worth mentioning, however, that trees can be seen as a special form of graph.
Operations
Graph algorithms are a significant field of interest within computer science. Typical operations associated with graphs are: finding a path between two nodes, like depth-first search and breadth-first search and finding the shortest path from one node to another, like Dijkstra's algorithm. A solution to finding the shortest path from each node to every other node also exists in the form of the Floyd-Warshall algorithm.
A directed graph can be seen as a flow network, where each edge has a capacity and each edge receives a flow. The Ford-Fulkerson algorithm is used to find out the maximum flow from a source to a sink in a graph.
The graphs can be represented in two ways. One is adjacency matrix and adjacency list.
For example, let us consider the following graph
A----------->B
| ^
| |
| |
V |
C ------------
Adjacency Matrix
A B C
A 0 1 1
B 0 0 0
C 0 1 0
Adjacency List
A ----> | B | ----> | C | ---- NULL
B ----> ---- NULL
C ----> | B | ---- NULL
Thursday, February 26, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment