130 likes | 498 Views
Data Structure. Topics to be discussed…. DATA STRUCTURE DATA STRUCTURE OPERATIONS BIG-O NOTATION TYPES OF DATA STRUCTURE ARRAY SPARSE MATRICES. DATA STRUCTURE. The logical and mathematical model of a particular organization of data is called data structure.
E N D
Topics to be discussed…. DATA STRUCTURE DATA STRUCTURE OPERATIONS BIG-O NOTATION TYPES OF DATA STRUCTURE ARRAY SPARSE MATRICES
DATA STRUCTURE The logical and mathematical model of a particular organization of data is called data structure. Interrelationship among data elements that determine how data is recorded, manipulated, stored, and presented by a database. Data structure must be rich enough to mirror the actual relationships of data in real world. Data structure should be simple enough that one can effectively process the data when necessary. back
DATA STRUCTURE OPERATIONS Traversing: accessing each record exactly once so that certain items in the record may be processed. Searching: Finding the location of the record with a given key value. Inserting: Adding a new record to the structure. Deleting: Removing a record from the structure.
ALGORITHMS: COMPLEXITY, TIME-SPACE TRADEOFF An algorithm is a well defined steps for solving a particular problem. The complexity of an algorithm is the function which gives the running time and space in terms of the input size. Time –space tradeoff- by increasing the amount of space for storing data, one may be able to reduce the time needed for processing the data and vice versa back
BIG-O NOTATION • A theoretical measure of the execution of an algorithm, usually the time or memory needed, given the problem size n, which is usually the number of items. Informally, saying some equation f(n) = O(g(n)) means it is less than some constant multiple of g(n). The notation is read, "f of n is big oh of g of n". • Formal Definition: f(n) = O(g(n)) means there are positive constants c and k, such that 0 ≤ f(n) ≤ cg(n) for all n ≥ k. The values of c and k must be fixed for the function f and must not depend on n. back
TYPES OF DATA STRUCTURE LINEAR NON LINEAR Array Tree stack graph Queue Linked list
Primitive data structure:. the data structure available to compiler is called primitive data structureNon primitive data structure: the data structure which is not available to compiler is called non primitive data structure. back
ARRAY An array is collection of homogeneous type of data elements. An array is consisting of collection of elements. An array can be represented as shown by diagram in memory
OPERATIONS ON ARRAY Traversing: accessing each element in an array Search: to find an element from an array Inserting: to insert an element in to an array Deleting: to delete an element in to an array Sorting: to arrange elements of an array in to an order Merging: to merge to array
TYPES OF ARRAY One Dimensional Array: int A[10]; Two dimensional Array: int a[10][25]; back
SPARSE MATRICES • An example sparse matrix: • A lot of “zero” entries. • Thus large memory space is wasted. 15 0 0 22 0 -15 0 11 3 0 0 0 0 0 0 -6 0 0 0 0 0 0 0 0 91 0 0 0 0 0 0 0 28 0 0 0 A = back