Posts

Showing posts from April, 2021

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...