From c7013d3b1b2899d6b51a00d537b02ddae1b0ac63 Mon Sep 17 00:00:00 2001 From: Bhrigu Kansra Date: Tue, 2 Oct 2018 00:17:59 +0530 Subject: [PATCH] Revert "Added 3 backtrack algorithms." --- contributors.md | 5 +-- knight-tour.cpp | 59 -------------------------- n-queen.cpp | 58 ------------------------- rat_in_a_maze.cpp | 105 ---------------------------------------------- 4 files changed, 1 insertion(+), 226 deletions(-) delete mode 100644 knight-tour.cpp delete mode 100644 n-queen.cpp delete mode 100644 rat_in_a_maze.cpp diff --git a/contributors.md b/contributors.md index 125d814..6a46934 100644 --- a/contributors.md +++ b/contributors.md @@ -1,6 +1,5 @@ # List of all contributors - 1. [Bhrigu Kansra](https://github.com/kinetickansra) 2. [Tathya Thaker](https://github.com/thetathya) 3. [Aslan](https://github.com/impeccableaslan) @@ -11,8 +10,6 @@ 8. [Joy Banerjee](https://github.com/joybanerjee08) 9. [Ambika](https://github.com/Ambika55) 10. [Shivam Yadav](https://github.com/shivamyadav2512) -11. [Nikhil Arora](https://github.com/nikhilarora06 - -12. [Your Name](https://github.com/yourprofile) +11. [Your Name](https://github.com/yourprofile) diff --git a/knight-tour.cpp b/knight-tour.cpp deleted file mode 100644 index 978a2d3..0000000 --- a/knight-tour.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include -# define n 8 -using namespace std; -bool issafe(int x,int y,int sol[n][n]) -{ - return (x=0 && y=0 && sol[x][y]==-1); - -} -bool solve(int x,int y, int mov, int sol[n][n], int xmov[n], int ymov[n]) -{ - int k,xnext,ynext; - - if(mov == n*n) - return true; - - for(k=0;k<8;k++) - { - xnext=x+xmov[k]; - ynext=y+ymov[k]; - - if(issafe(xnext,ynext,sol)) - { - sol[xnext][ynext]=mov; - - if(solve(xnext,ynext,mov+1,sol,xmov,ymov)==true) - return true; - else - sol[xnext][ynext]=-1; - } - } - return false; -} -int main() -{ - //initialize(); - - int sol[n][n]; - int i,j; - for(i=0;i -#define n 4 -using namespace std; -bool issafe(int board[n][n], int row, int col) -{ - int i,j; - for(i=0;i=0 && j>=0;i--,j--) - if(board[i][j]) - return false; - for(i=row,j=col;i=0; i++,j--) - if(board[i][j]) - return false; - - return true; -} -bool solve(int board[n][n], int col) -{ - if(col>=n) - return true; - int i; - for(i=0;i -#define n 4 -using namespace std; - -int sol[n][n]= {{0,0,0,0}, - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0,}}; - -void print(int sol[n][n]); - -int issafe(int maze[n][n], int row, int col) -{ - if(row>=0 && row=0 && col