Beruflich Dokumente
Kultur Dokumente
Date:02/02/2012
Abstract data type:- It is a mathematical logical concept that defines a data type. Data type:- A method of interpreting a bit pattern is called a data type. Algorithm:- It is a step by step procedure to solve a given problem.
Representation of ve number is done by two ways- 1s complement & 2s complement, Concept of Logarithm & its properties. Date: 03/02/2012
Efficiency of Algorithm
It is determined by measuring the time and space required to execute the program. Amount of time taken (called time complexity) is calculated by finding the total no. of steps to be executed in the program. The space taken (called space complexity) is the no. of units required for memory storage.
- Space Complexity:It has three components. a) Instruction space (the space where compiled instructions are kept). b) Data space (variables, constants etc. are kept here). c) Environment space (space required in runtime).
Date: 06/02/2012
Asymptotic Notation:1) Big-Oh [O]:- Provides an upper limit for a function f. A function f(n)=O(g(n)) if there exists +ve constants c & n0 such that f(n)<=c.g(n), for all n>=n0 2) Big-Omega[]:- Provides lower limit of a function f. A function f(n)= (h(n)) if there exists +ve constants c & n0 such that f(n)>=c.h(n), for all n>=n0 3) Big-Theta[]:- Provides an upper limit as well as lower limit of a function f. A function f(n)= (g(n)) if there exists +ve constants C1,C2 & n0 such that C1.g(n)<=f(n)<=C2.g(n), for all n>=n0
- Big-Oh [O] Properties:a) b) c) d) If f(n) is a constant, then f(n)=O(1). If f(n)=O(h(n)) & g(n)=O(h(n)), then f(n)+g(n)=O(h(n)). All log functions are O(log n) ,independent of their bases. A polynomial function with a leading power k, C1.nk+C2.nk-1+.Ck.n+Ck+1=O (nk).
Timespace Tradeoff:- One algorithm may require more space but less time to complete its execution while the other algorithm requires less time space but takes more time to complete its execution. Thus, we may have to sacrifice one at the cost of the other. If the space is our constraint, then we have to choose a program that requires less space at the cost of more execution time. On the other hand, if time is our constraint such as in real time system, we have to choose a program that takes less time to complete its execution at the cost of more space. This is known as time space tradeoff.
Date: 07/02/2012
Topic: Arrays
-
Accessing an array:-
Array Bounds:- An array has upper bound as well as lower bound. We can find the
range of an array by following calculation. Range=Upper bond - lower bound+1.
Array can be represented in 2 way: a) 1-dimensional & b) Multi-dimensional. 2-D array is declared by int a[4][2] i.e in matrix form it has 4 row and 2 column. 2-D array can be represented in two ways: a) Row-major Order. b) Column-major Order.
Sparse matrix:- A sparse array is an array where nearly all of the elements have the
same value (usually zero) and this value is a constant. One-dimensional sparse array is called sparse vectors and two-dimensional sparse arrays are called sparse matrix. Identity matrix is the example of sparse matrix. 1 0 0 0 1 0 0 0 1
info next
node
node
node
SOME Notations: Let P be a pointer to a node , then: Node (P) refers to the node pointed by P. Info (P) refers to the information content of that node P Next (P) refer to the address of the next node in the same linked list.