Algorithm1, a parameter is a special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. [1] These pieces of data are called arguments. An ordered list of parameters is usually included in the definition of a subroutine, so that, each time the subroutine is called, its arguments for that call can be assigned to the corresponding parameters.

Just as in standard mathematical usage, the argument is thus the actual value passed to a function, procedure, or routine (such as 37 in log(37)), whereas the parameter is a reference to that value inside the implementation of the function (log in this case). See the Parameters and arguments section for more information. In the most common case, call-by-value, a parameter acts within the subroutine as a local (isolated) copy of the argument, but in other cases, e. g. call-by-reference, the argument supplied by the caller can be affected by actions within the called subroutine (as discussed in evaluation strategy).

The semantics for how parameters can be declared and how the arguments get passed to the parameters of subroutines are defined by the language, but the details of how this is represented in any particular computer system depend on the calling conventions of that system. ————————————————- Example The following program in the C programming language defines a function that is named “sales_tax” and has one parameter named “price”. The type of price is “double” (i. e. a double-precision floating point number). The function’s return type is also a double. double sales_tax(double price) { eturn 0. 05 * price; } After the function has been defined, it can be invoked as follows: sales_tax(10. 00); In this example, the function has been invoked with the number 10. 00. When this happens, 10. 00 will be assigned to price, and the function begins calculating its result. The steps for producing the result are specified below enclosed in {} “0. 05 * price” indicates that the first thing to do is multiply 0. 05 by the value of price, which gives 0. 50. “return” means the function will produce the result of “0. 05 * price”. Therefore, the final result is 0. 50. 2 A, Time Complexity: Determine the approximate number f operations required to solve a problem of size n. Space Complexity: Determine the approximate memory Required to solve a problem of size n. Time Complexity – Use the Big-O notation – Ignore house keeping – Count the e xpensive operations only Basic operations: • searching algorithms – key comparisons • sorting algorithms – list component comparisons • numerical algorithms – floating point ops. (flops) – multiplications/divisions and/or additions/subtractions Worst Case: maximum number of operations Average Case: mean number of operations assuming an input probability distribution Examples: Multiply an n x n matrix A by a scalar c to produce the matrix B: procedure (n, c, A, B) for i from 1 to n do for j from 1 to n do B(i, j) = cA(i, j) end do end do Analysis (worst case): Count the number of floating point multiplications. n2 elements requires n2 multiplications. time complexity is O(n2) or quadratic complexity. 2B, An algorithm to solve a particular task employs some set of basic operations. When we estimate the amount of work done by an algorithm we usually do not consider all the steps such as e. g. initializing certain variables.

Generally, the total number of steps is roughly proportional to the number of the basic operations. Thus, we are concerned mainly with the basic operations – how many times the basic operations have to be performed depending on the size of input. Typical basic operations for some problems are the following: Problem| Operation| Find x in an array| Comparison of x with an entry in the array| Multiplying two matrices with real entries| Multiplication of two real numbers| Sort an array of numbers| Comparison of two array entries plus moving elements in the array| Traverse a tree| Traverse an edge| Problem| Size of input|

Find x in an array| The number of the elements in the array| Multiply two matrices| The dimensions of the matrices| Sort an array| The number of elements in the array| Traverse a binary tree| The number of nodes| Solve a system of linear equations| The number of equations, or the number of the unknowns, or both| 3, explaine stack application 1-) to check wither a given string if palindrome or not. 2-) to convert infix to post fix and prefix . 3-) To evaluate post fix expiration . 4-) to check the right order of parenthesis of given expiration A stack is used for LIFO (last in, first out) or for FIFO (first in first out).

That means when ever you store the data it will be stored in form of table. You can store the data in first row and can take out the data from first row or store the data in last row and can take out the data from first row. Cant take out the data from the middle rows. Stack Data Structure having one end from which we can enter data and retrieve data. Stack follow LIFO rule, which means (if “data is entered first it will be retrieve in last” of all existing element. If “data is entered last it will be retrieved first” of all 5, Hashing: Collision Resolution Schemes • Collision Resolution Techniques Separate Chaining • Separate Chaining with String Keys • Separate Chaining versus Open-addressing • The class hierarchy of Hash Tables • Implementation of Separate Chaining • Introduction to Collision Resolution using Open Addressing • Linear Probing2 Collision Resolution Techniques • There are two broad ways of collision resolution: 1. Separate Chaining:: An array of linked list implementation. 2. Open Addressing: Array-based implementation. (i) Linear probing (linear search) (ii) Quadratic probing (nonlinear search) (iii) Double hashing (uses two hash functions)