Posts

FALSE POSITION METHOD

Image
  FALSE POSITION METHOD , USE : • Find root of contineous function of f(x). APPROACH : a) Find interval [a b] such that as     • f(a) and (b) must have different Signs       Somewhere in between must be Zero. b) Compute Secant between  and b*f(b)). c) Take point c which be present on Secant as well as x axis. d) Replace a or b with matching.    Sign of f(c)    Such that F (a)* F (c)<0 or   F (b)* F (c)<0  e)Repeat this_ process upto giver   iterations.   calculated C  =(a*func(b)-b*func(a))/(func(b)-func(a)); FLOWCHART of FALSE position method STEP 1)Take two points a and b , and find f(a)*f(b)<0     STEP 2) we draw Secant between f(a) and f (b) is secant         AB line is a Secant.         Now we choose C where secant cut to the X axis. STEP 3) Cheak    fu...

DNF sorting ( 0s , 1s , 2s, sorting )

Image
ABOUT  DNF  SORTING  WHAT IS SORTING?   Sorting    is   a   process   of   arranging   items (   any things   ex :- ,elements in array   , table , marks , price of things etc)   in systematically   such that   in ascending   or descending    in form of   correctly   sequence . 1.          Ordering :- Arranging items   in a sequence ordered by some   strategy. 2.        Categorizing :- grouping elements in similar properties.                                    WHAT IS DNF SORTING?   It is   also   known   as Dutch National Flag   .Some times    It is known    by     0 ,1, 2s sorting. ...

Write the program to arrange the n queen(queen of chessboard) in n*n matrix such that they can not ATTACK TO eachother.

Image
  OUTPUT : In form of matrix of elements (0 and 1)     where 1 is suitable position where can be keep without attack to each other.   USED : Recursion , BACKTRACKING etc CHARACTERISTICS   OF QUEEN :     A )They can move in any position in a row where it is presence.     B )They can move in any position in a column where it is presence.     C )They can move in any position in a diagonal where it is presence. CONDITION :     Arrange the queen such that they can not ATTACK to each other.     in n*n matrix       APPROCH :    A )put a queen in a row than move next row to put      the next queen in next row such that they can not ATTACK each other        After matrix 4 they are not any place where a queen can be Put without attack by anyone so BACKTRACK occur here and reach again to Matrix 1 and then continue...

write a program for finding the path in maze from, begin to end

Image
write a program for finding the path in maze from, begin to end ABOUT FIGURE :Deep blue indicates wall and deep green denotes free path. In above figure , upper matrix is input In below matrix is output (path in form of 1) CONDITION : movement takeplace ony in positive x direction                   and in negative y direction APPROCH :  a)in a maze 1 denote movement space and 0 denote wall   b)use recursion to find the way by reducing number of box   c)use a new_array which initialisation by 0,and after getting path         become 1 on that place.   D ) use BACKTRACKING ,if_rat will not get path then it take back the path      this_ is known as backtracking. backtracking (algorithmic technique) Definition:  Find a solution by trying one of several choices. If the choice proves incorrect, computation  backtrac...

Write the program for finding aprroxiamate root of a function by Bisection method

Image
The method is applicable for numerically solving the equation  f ( x ) = 0 for the  real  variable  x , where  f  is a  continuous function  defined on an interval [ a ,  b ] and where  f ( a ) and  f ( b ) have opposite signs. In this case   a  and  b  are said to bracket a root since, by the  intermediate value theorem , the continuous function  f  must have at least one root in the interval ( a ,  b ). At each step the method divides the interval in two by computing the midpoint  c  = ( a + b ) / 2 of the interval and the value of the function  f ( c ) at that point. Unless  c  is itself a root (which is very unlikely, but possible) there are now only two possibilities: either  f ( a ) and  f ( c ) have opposite signs and bracket a root, or  f ( c ) and  f ( b ) have opposite signs and bracket a root. [5]  The method sele...

Write the program to determine the maximum possible way to reach the end from starting in game board.

Image
         #include <iostream> #include <string> using namespace std;   int maxpath( int str, int end)    {   if (str==end)            {  return 1;} //when number of blocks be lessthen no of jumps(max jump 6)      if (str>end)       {return 0;} // then this conditio n will follow satisfy.                             int count=0;          for ( int i=1;i<=6;i++)         {  count =count + maxpath(str+i,end);}       return count;        }                int main() {    int   str=1; //str = ...

Write the program to make Permutation(arrangements of string ) of a string .

Image
http://cpp.sh/6tjpq   some points :- 1_ )Permutation :- A permutation is a mathematical technique      that determines the number of possible arrangements in a set     when the order of the arrangements matters.     2_ ) Syntex   :: string.substr(i  , ln  )       Use of this Syntex :- to make        substring (i.e make small         String from big string).      i = i represent index.      ln= ln represent lenth of string           ex:- let string  a = "abgs" ;             cout<<a.substr(0,0) //print nothing lenth is zero             cout<<a.substr(0,1) //print 'a' because at zero index 'a' is present and length is 1     ...