Algorithm 2.2:    (Quadratic Equation) This algorithm inputs the coefficients A, B, C of a quadratic equation and outputs the real solutions, if any.
Step 1: Read A, B, C.
Step 2: Set D = B2 – 4AC.
Step 3: If D>0, then
    Set X1 = (-B+√D)/2A and X2 = (-B-√D)/2A.
    Write X1, X2.
          Else if D = 0, then
    Set X = -B/2A.
    Write ‘UNIQUE SOLUTIONS ’, X.
Else
    Write ‘NO REAL SOLUTIONS’.
[End of if structure]
Step 4: Exit.
Algorithm2.3: (Largest element in Array) Given, a non empty array DATA with N numerical values, this algorithm finds the location LOC and the value MAX of the largest element of DATA.
Step 1: Set K = 1, LOC = 1 and MAX = DATA [1].
Step 2: Repeat Steps 3 and 4 while K ≤ N.
Step 3: If MAX < DATA [K], then
        Set LOC = K and MAX = DATA [K].
    [End of if structure]
Step 4: Set K = K+1.
    [End of step 2 loop]
Step 5: Write LOC, MAX.
Step 6: Exit.
Algorithm 2.4: (Linear search) A linear array DATA with N elements and a specific ITEM of information are given. This algorithm finds the location LOC of ITEM in the array DATA or sets LOC = 0.
Step 1: Set K = 1, LOC = 0.
Step 2: Repeat Steps 3 and 4 while LOC = 0and K≤ N.
Step 3: If ITEM = DATA [K] then Set LOC = K
Step 4: Set K = K+1.
    [End of step 2 loop]
Step 5: If LOC = 0 then
              Write ITEM is not in the array DATA.
    Else
              Write LOC is the location of ITEM.
    [End of if structure]
Step 6: Exit.
Algorithm 3.1: (Delete) A text T and a pattern P are in memory. This algorithm deletes every occurrence of P in T.
Step 1: Set K = INDEX (T, P).
Step 2: Repeat while K ≠ 0
    Set T = DELETE(T, INDEX(T,P),LENGTH(P))
    Set K = INDEX (T, P).
Step 3: Write T.
Step 4: Exit.
Algorithm 3.2: (Replacement) A text T, pattern P and Q are in memory. This algorithm replaces every occurrence of P in T by Q. 
Step 1: Set K = Index (T, P)
Step 2: Repeat while K ≠ 0.
    Set T = REPLACE (T, P, Q).
    Set K = INDEX (T, P).
[End of loop]
Step 3: Write T.
Step 4: Exit.
Algorithm 3.3: (Pattern matching) P and T are strings with length R and S, respectively, and are stored as arrays with one character per element. This algorithm finds the INDEX of P in T.
 Step 1: Set K = 1 and MAX = S – R + 1.
Step 2: Repeat steps 3 to 5 while K ≤ MAX.
Step 3: Repeat for L = 1 to R.
    If P[L] ≠ T[K + L – 1],
    Then go to step 5.
    [End of inner loop]
Step 4: Set INDEX = K and Exit.
Step 5: Set K = K + 1.
    [End of step 2 outer loop]
Step 6: Set INDEX = 0.
Step 7: Exit.
Search This Blog
Monday, July 13, 2009
Friday, July 10, 2009
Answer the questions
- a. Define degenerate and non-degenerate linear equation with example.
 - Solve the following systems of linear equation:-
 
3x1-x2+x3=-2
 x1+5x2+2x3=6
 2x1+3x2+x3=0
- Find out the conditions on α, β and γ so that the following system of non-homogenous linear equations has a solution:-
 
x+2y-3z=α
 3x-y+2z=β
 2x-10y+16z=2γ
- a. Write down the definition of the following matrices:-
 
- Symmetric;
 - Skew symmetric
 - Nilpotent matrices.
 - If A and B are comparable matrices and At and Bt are the transpose matrices of A and B respectively then show that, (AB)t=BtAt.
 
- Define sub-space of a vector space.
 - Let S be a non-empty sub-set of a vector space V then show that, <(S) is a sub-space of V containing S. furthermore, if W is any other sub-space of V containing S, then prove that, <(S) W.
 - Define linear dependence. Show that the non-zero vector v1, v2,……………. vn in a vector space v are linearly dependent if one of the vectors vk is a linear combination f the preceding vectors v1, v2,……………. Vk-1.
 - Determine a basis and the dimension for the solution space of the homogeneous system:-
 
x-3y+z=0
 2x-6y+2z=0
 3x-9y+3z=0
 Group-B differential equation
- Define ordinary and particular differential equations with examples. Also define order and degree of a differential equation.
 
Subscribe to:
Comments (Atom)
