• Practice Backtracking
  • Interview Problems on Backtracking
  • MCQs on Backtracking
  • Tutorial on Backtracking
  • Backtracking vs Recursion
  • Backtracking vs Branch & Bound
  • Print Permutations
  • Subset Sum Problem
  • N-Queen Problem
  • Knight's Tour
  • Sudoku Solver
  • Rat in Maze
  • Hamiltonian Cycle
  • Graph Coloring
  • Backtracking Algorithm
  • Introduction to Backtracking - Data Structure and Algorithm Tutorials
  • Difference between Backtracking and Branch-N-Bound technique
  • What is the difference between Backtracking and Recursion?

Standard problems on backtracking

  • The Knight's tour problem
  • Rat in a Maze
  • N Queen Problem
  • Subset Sum Problem using Backtracking
  • M-Coloring Problem
  • Algorithm to Solve Sudoku | Sudoku Solver
  • Magnet Puzzle
  • Remove Invalid Parentheses
  • A backtracking approach to generate n bit Gray Codes
  • Permutations of given String

Easy Problems on Backtracking

  • Print all subsets of a given Set or Array
  • Check if a given string is sum-string
  • Count all possible Paths between two Vertices
  • Find all distinct subsets of a given set using BitMasking Approach
  • Find if there is a path of more than k length from a source
  • Print all paths from a given source to a destination
  • Print all possible strings that can be made by placing spaces

Medium prblems on Backtracking

  • 8 queen problem
  • Combinational Sum
  • Warnsdorff's algorithm for Knight’s tour problem
  • Find paths from corner cell to middle cell in maze
  • Find Maximum number possible by doing at-most K swaps
  • Rat in a Maze with multiple steps or jump allowed
  • N Queen in O(n) space

Hard problems on Backtracking

  • Power Set in Lexicographic order
  • Word Break Problem using Backtracking
  • Partition of a set into K subsets with equal sum
  • Longest Possible Route in a Matrix with Hurdles
  • Find shortest safe route in a path with landmines
  • Printing all solutions in N-Queen Problem
  • Print all longest common sub-sequences in lexicographical order
  • Top 20 Backtracking Algorithm Interview Questions

The Knight’s tour problem

Backtracking is an algorithmic paradigm that tries different solutions until finds a solution that “works”. Problems that are typically solved using the backtracking technique have the following property in common. These problems can only be solved by trying every possible configuration and each configuration is tried only once. A Naive solution for these problems is to try all configurations and output a configuration that follows given problem constraints. Backtracking works incrementally and is an optimization over the Naive solution where all possible configurations are generated and tried. For example, consider the following Knight’s Tour problem. 

Problem Statement: Given a N*N board with the Knight placed on the first block of an empty board. Moving according to the rules of chess knight must visit each square exactly once. Print the order of each cell in which they are visited.

The path followed by Knight to cover all the cells Following is a chessboard with 8 x 8 cells. Numbers in cells indicate the move number of Knight. 

knight-tour-problem

Let us first discuss the Naive algorithm for this problem and then the Backtracking algorithm.

Naive Algorithm for Knight’s tour   The Naive Algorithm is to generate all tours one by one and check if the generated tour satisfies the constraints. 

Backtracking works in an incremental way to attack problems. Typically, we start from an empty solution vector and one by one add items (Meaning of item varies from problem to problem. In the context of Knight’s tour problem, an item is a Knight’s move). When we add an item, we check if adding the current item violates the problem constraint, if it does then we remove the item and try other alternatives. If none of the alternatives works out then we go to the previous stage and remove the item added in the previous stage. If we reach the initial stage back then we say that no solution exists. If adding an item doesn’t violate constraints then we recursively add items one by one. If the solution vector becomes complete then we print the solution.

Backtracking Algorithm for Knight’s tour  

Following is the Backtracking algorithm for Knight’s tour problem. 

Following are implementations for Knight’s tour problem. It prints one of the possible solutions in 2D matrix form. Basically, the output is a 2D 8*8 matrix with numbers from 0 to 63 and these numbers show steps made by Knight.   

Time Complexity :  There are N 2 Cells and for each, we have a maximum of 8 possible moves to choose from, so the worst running time is O(8 N^2 ).

Auxiliary Space: O(N 2 )

Important Note: No order of the xMove, yMove is wrong, but they will affect the running time of the algorithm drastically. For example, think of the case where the 8th choice of the move is the correct one, and before that our code ran 7 different wrong paths. It’s always a good idea a have a heuristic than to try backtracking randomly. Like, in this case, we know the next step would probably be in the south or east direction, then checking the paths which lead their first is a better strategy.

Note that Backtracking is not the best solution for the Knight’s tour problem. See the below article for other better solutions. The purpose of this post is to explain Backtracking with an example.  Warnsdorff’s algorithm for Knight’s tour problem

References:  http://see.stanford.edu/materials/icspacs106b/H19-RecBacktrackExamples.pdf   http://www.cis.upenn.edu/~matuszek/cit594-2009/Lectures/35-backtracking.ppt   http://mathworld.wolfram.com/KnightsTour.html   http://en.wikipedia.org/wiki/Knight%27s_tour    

Please Login to comment...

Similar reads.

  • chessboard-problems
  • Backtracking
  • Mathematical

advertisewithusBannerImg

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

  • Create Account

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

Sign in to post your reply or Sign up for a free account.

Similar topics

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use .

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.

Close

Welcome.please sign up.

By signing up or logging in, you agree to our Terms of service and confirm that you have read our Privacy Policy .

Already a member? Go to Log In

Welcome.please login.

Forgot your password

Not registered yet? Go to Sign Up

  • Introduction
  • Analyze Your Algorithm
  • Growth of a Function
  • Analyze Iterative Algorithms
  • Recurrences
  • Let's Iterate
  • Now the Recursion
  • Master's Theorem
  • Sort It Out
  • Bubble Sort
  • Count and Sort
  • Divide and Conquer
  • Binary Search
  • Dynamic Programming
  • Knapsack Problem
  • Rod Cutting
  • Coin Change
  • Backtracking
  • Knight's Tour Problem
  • Greedy Algorithm
  • Activity Selection
  • Egyptian Fraction
  • Huffman Codes
  • Minimum Spanning Tree
  • Prim's Algorithm

Knight's Tour Problem | Backtracking

In the previous example of backtracking , you have seen that backtracking gave us a $O(n!)$ running time. Generally, backtracking is used when we need to check all the possibilities to find a solution and hence it is expensive. For the problems like N-Queen and Knight's tour, there are approaches which take lesser time than backtracking, but for a small size input like 4x4 chessboard, we can ignore the running time and the backtracking leads us to the solution.

Knight's tour is a problem in which we are provided with a NxN chessboard and a knight.

chessboard and knight

For a person who is not familiar with chess, the knight moves two squares horizontally and one square vertically, or two squares vertically and one square horizontally as shown in the picture given below.

movement of a knight

Thus if a knight is at (3, 3), it can move to the (1, 2) ,(1, 4), (2, 1), (4, 1), (5, 2), (5, 4), (2, 5) and (4, 5) cells.

Thus, one complete movement of a knight looks like the letter "L", which is 2 cells long.

movement of knight to form L

According to the problem, we have to make the knight cover all the cells of the board and it can move to a cell only once.

There can be two ways of finishing the knight move - the first in which the knight is one knight's move away from the cell from where it began, so it can go to the position from where it started and form a loop, this is called closed tour ; the second in which the knight finishes anywhere else, this is called open tour .

Approach to Knight's Tour Problem

Similar to the N-Queens problem, we start by moving the knight and if the knight reaches to a cell from where there is no further cell available to move and we have not reached to the solution yet (not all cells are covered), then we backtrack and change our decision and choose a different path.

So from a cell, we choose a move of the knight from all the moves available, and then recursively check if this will lead us to the solution or not. If not, then we choose a different path.

valid cells for movement of knight

As you can see from the picture above, there is a maximum of 8 different moves which a knight can take from a cell. So if a knight is at the cell (i, j), then the moves it can take are - (i+2, j+1), (i+1, j+2), (i-2,j+1), (i-1, j+2), (i-1, j-2), (i-2, j-1), (i+1, j-2) and (i+2, j-1).

tracking movement of knight

We keep the track of the moves in a matrix. This matrix stores the step number in which we visited a cell. For example, if we visit a cell in the second step, it will have a value of 2.

last move is NxN

This matrix also helps us to know whether we have covered all the cells or not. If the last visited cell has a value of N*N, it means we have covered all the cells.

Thus, our approach includes starting from a cell and then choosing a move from all the available moves. Then we check if this move will lead us to the solution or not. If not, we choose a different move. Also, we store all the steps in which we are moving in a matrix.

Now, we know the basic approach we are going to follow. So, let's develop the code for the same.

Code for Knight's Tour

Let's start by making a function to check if a move to the cell (i, j) is valid or not - IS-VALID(i, j, sol) . As mentioned above, 'sol' is the matrix in which we are storing the steps we have taken.

A move is valid if it is inside the chessboard (i.e., i and j are between 1 to N) and if the cell is not already occupied (i.e., sol[i][j] == -1 ). We will make the value of all the unoccupied cells equal to -1.

As stated above, there is a maximum of 8 possible moves from a cell (i, j). Thus, we will make 2 arrays so that we can use them to check for the possible moves.

Thus if we are on a cell (i, j), we can iterate over these arrays to find the possible move i.e., (i+2, j+1), (i+1, j+2), etc.

Now, we will make a function to find the solution. This function will take the solution matrix, the cell where currently the knight is (initially, it will be at (1, 1)), the step count of that cell and the two arrays for the move as mentioned above - KNIGHT-TOUR(sol, i, j, step_count, x_move, y_move) .

We will start by checking if the solution is found. If the solution is found ( step_count == N*N ), then we will just return true.

KNIGHT-TOUR(sol, i, j, step_count, x_move, y_move)   if step_count == N*N     return TRUE

Our next task is to move to the next possible knight's move and check if this will lead us to the solution. If not, then we will select the different move and if none of the moves are leading us to the solution, then we will return false.

As mentioned above, to find the possible moves, we will iterate over the x_move and the y_move arrays.

KNIGHT-TOUR(sol, i, j, step_count, x_move, y_move)   ...   for k in 1 to 8     next_i = i+x_move[k]     next_j = j+y_move[k]

Now, we have to check if the cell (i+x_move[k], j+y_move[k]) is valid or not. If it is valid then we will move to that cell - sol[i+x_move[k]][j+y_move[k]] = step_count and check if this path is leading us to the solution ot not - if KNIGHT-TOUR(sol, i+x_move[k], j+y_move[k], step_count+1, x_move, y_move) .

KNIGHT-TOUR(sol, i, j, step_count, x_move, y_move)   ...   for k in 1 to 8     ...     if IS-VALID(i+x_move[k], j+y_move[k])       sol[i+x_move[k]][j+y_move[k]] = step_count       if KNIGHT-TOUR(sol, i+x_move[k], j+y_move[k], step_count+1, x_move, y_move)         return TRUE

If the move (i+x_move[k], j+y_move[k]) is leading us to the solution - if KNIGHT-TOUR(sol, i+x_move[k], j+y_move[k], step_count+1, x_move, y_move) , then we are returning true.

If this move is not leading us to the solution, then we will choose a different move (loop will iterate to a different move). Also, we will again make the cell (i+x_move[k], j+y_move[k]) of solution matrix -1 as we have checked this path and it is not leading us to the solution, so leave it and thus it is backtracking.

KNIGHT-TOUR(sol, i, j, step_count, x_move, y_move)   ...   for k in 1 to 8     ...       sol[i+x_move[k], j+y_move[k]] = -1

At last, if none the possible move returns us false, then we will just return false.

We have to start the KNIGHT-TOUR function by passing the solution, x_move and y_move matrices. So, let's do this.

As stated earlier, we will initialize the solution matrix by making all its element -1.

for i in 1 to N   for j in 1 to N     sol[i][j] = -1

The next task is to make x_move and y_move arrays.

x_move = [2, 1, -1, -2, -2, -1, 1, 2] y_move = [1, 2, 2, 1, -1, -2, -2, -1]

We will start the tour of the knight from the cell (1, 1) as its first step. So, we will make the value of the cell(1, 1) 0 and then call KNIGHT-TOUR(sol, 1, 1, 1, x_move, y_move) .

Analysis of Code

We are not going into the full time complexity of the algorithm. Instead, we are going to see how bad the algorithm is.

There are N*N i.e., N 2 cells in the board and we have a maximum of 8 choices to make from a cell, so we can write the worst case running time as $O(8^{N^2})$.

But we don't have 8 choices for each cell. For example, from the first cell, we only have two choices.

movement of cells from 1

Even considering this, our running time will be reduced by a factor and will become $O(k^{N^2})$ instead of $O(8^{N^2})$. This is also indeed an extremely bad running time.

So, this chapter was to make you familiar with the backtracking algorithm and not about the optimization. You can look for more examples on the backtracking algorithm with the backtracking tag of the BlogsDope .

BlogsDope App

knight's tour recursion c

  • Table of Contents
  • Course Home
  • Assignments
  • Peer Instruction (Instructor)
  • Peer Instruction (Student)
  • Change Course
  • Instructor's Page
  • Progress Page
  • Edit Profile
  • Change Password
  • Scratch ActiveCode
  • Scratch Activecode
  • Instructors Guide
  • About Runestone
  • Report A Problem
  • 9.1 Objectives
  • 9.2 Vocabulary and Definitions
  • 9.3 The Graph Abstract Data Type
  • 9.4 An Adjacency Matrix
  • 9.5 An Adjacency List
  • 9.6 Implementation
  • 9.7 The Word Ladder Problem
  • 9.8 Building the Word Ladder Graph
  • 9.9 Implementing Breadth First Search
  • 9.10 Breadth First Search Analysis
  • 9.11 The Knight’s Tour Problem
  • 9.12 Building the Knight’s Tour Graph
  • 9.13 Implementing Knight’s Tour
  • 9.14 Knight’s Tour Analysis
  • 9.15 General Depth First Search
  • 9.16 Depth First Search Analysis
  • 9.17 Topological Sorting
  • 9.18 Strongly Connected Components
  • 9.19 Shortest Path Problems
  • 9.20 Dijkstra’s Algorithm
  • 9.21 Analysis of Dijkstra’s Algorithm
  • 9.22 Prim’s Spanning Tree Algorithm
  • 9.23 Summary
  • 9.24 Discussion Questions
  • 9.25 Programming Exercises
  • 9.26 Glossary
  • 9.12. Building the Knight’s Tour Graph" data-toggle="tooltip">
  • 9.14. Knight’s Tour Analysis' data-toggle="tooltip" >

9.13. Implementing Knight’s Tour ¶

The search algorithm we will use to solve the knight’s tour problem is called depth first search ( DFS ). Whereas the breadth first search algorithm discussed in the previous section builds a search tree one level at a time, a depth first search creates a search tree by exploring one branch of the tree as deeply as possible. In this section we will look at two algorithms that implement a depth first search. The first algorithm we will look at directly solves the knight’s tour problem by explicitly forbidding a node to be visited more than once. The second implementation is more general, but allows nodes to be visited more than once as the tree is constructed. The second version is used in subsequent sections to develop additional graph algorithms.

The depth first exploration of the graph is exactly what we need in order to find a path that has exactly 63 edges. We will see that when the depth first search algorithm finds a dead end (a place in the graph where there are no more moves possible) it backs up the tree to the next deepest vertex that allows it to make a legal move.

The knightTour function takes four parameters: n , the current depth in the search tree; path , a list of vertices visited up to this point; u , the vertex in the graph we wish to explore; and limit the number of nodes in the path. The knightTour function is recursive. When the knightTour function is called, it first checks the base case condition. If we have a path that contains 64 vertices, we return from knightTour with a status of True , indicating that we have found a successful tour. If the path is not long enough we continue to explore one level deeper by choosing a new vertex to explore and calling knightTour recursively for that vertex.

DFS also uses colors to keep track of which vertices in the graph have been visited. Unvisited vertices are colored white, and visited vertices are colored gray. If all neighbors of a particular vertex have been explored and we have not yet reached our goal length of 64 vertices, we have reached a dead end. When we reach a dead end we must backtrack. Backtracking happens when we return from knightTour with a status of False . In the breadth first search we used a queue to keep track of which vertex to visit next. Since depth first search is recursive, we are implicitly using a stack to help us with our backtracking. When we return from a call to knightTour with a status of False , in line 11, we remain inside the while loop and look at the next vertex in nbrList .

Let’s look at a simple example of knightTour in action. You can refer to the figures below to follow the steps of the search. For this example we will assume that the call to the getConnections method on line 6 orders the nodes in alphabetical order. We begin by calling knightTour(0,path,A,6)

knightTour starts with node A Figure 3 . The nodes adjacent to A are B and D. Since B is before D alphabetically, DFS selects B to expand next as shown in Figure 4 . Exploring B happens when knightTour is called recursively. B is adjacent to C and D, so knightTour elects to explore C next. However, as you can see in Figure 5 node C is a dead end with no adjacent white nodes. At this point we change the color of node C back to white. The call to knightTour returns a value of False . The return from the recursive call effectively backtracks the search to vertex B (see Figure 6 ). The next vertex on the list to explore is vertex D, so knightTour makes a recursive call moving to node D (see Figure 7 ). From vertex D on, knightTour can continue to make recursive calls until we get to node C again (see Figure 8 , Figure 9 , and Figure 10 ). However, this time when we get to node C the test n < limit fails so we know that we have exhausted all the nodes in the graph. At this point we can return True to indicate that we have made a successful tour of the graph. When we return the list, path has the values [A,B,D,E,F,C] , which is the the order we need to traverse the graph to visit each node exactly once.

../_images/ktdfsa.png

Figure 3: Start with node A ¶

../_images/ktdfsb.png

Figure 4: Explore B ¶

../_images/ktdfsc.png

Figure 5: Node C is a dead end ¶

../_images/ktdfsd.png

Figure 6: Backtrack to B ¶

../_images/ktdfse.png

Figure 7: Explore D ¶

../_images/ktdfsf.png

Figure 8: Explore E ¶

../_images/ktdfsg.png

Figure 9: Explore F ¶

../_images/ktdfsh.png

Figure 10: Finish ¶

Figure 11 shows you what a complete tour around an eight-by-eight board looks like. There are many possible tours; some are symmetric. With some modification you can make circular tours that start and end at the same square.

../_images/completeTour.png

Figure 11: A Complete Tour of the Board ¶

Q-1: True/False: The Knight’s Tour Graph contains as many vertices as there are tiles on a chessboard.

  • You are correct!
  • No; remember the implementation of Matrix graphs.

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

The Knight's Tour Algorithms in C++

wisn/knights-tour

Folders and files, repository files navigation, knight's tour.

The Knight's tour algorithms in C++. Several algorithms implementation and its outputs included. This repository created for educational purpose.

Implementation

  • Brute-force algorithm
  • Common backtracking algorithm
  • Warnsdorff's rule algorithm

There are several outputs available for each implementation. The solution (output) is based on the Knight's legal moves sequence. Each type of sequence will produces different solution. The default moves is {(1, 2), (2, 1), (-1, 2), (1, -2), (-2, 1), (2, -1), (-2, -1), (-1, -2)} in the form of (x, y) .

As an example, from that sequence above, using the starting point at (0, 0) on the 8x8 chessboard, the output will be:

Then, if we change the sequence to {2, 1}, {1, 2}, {-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1} in the form of (x, y) , the output will be:

How to generate the outputs?

First, edit the part of n variable which is denoting the chessboard. As an example, edit it to this code below.

Compile the source code into an executable file. I assume that we using the *NIX family operating system and g++ compiler.

Then, using the command line (bash), write this command below.

Edit the {1..100} interval part as we needed. Last, wait until its done.

Brute-force Implementation

There are at least 10 outputs included.

Common Backtracking Implementation

Warnsdorff's rule implementation.

Since the file size is too huge, there are at least 50 outputs included.

Performance Comparison

Since 2x2, 3x3, and 4x4 doesn't have any solution, we skip them.

Hardware Specifications

Tested on the ASUS A455L Notebook with the Intel Core i3-5005U 2GHz and 4GB DDR3 RAM.

Comparison Result

For each algorithm, the form of the result will be A (B, C) where A is the first try success at the random starting point (seconds), B is the number of success starting point(s), and C is the number of fails starting point(s). The fails starting point could be either timeout or no solution found. The timeout limit is 20 seconds for each starting point.

The Warnsdorff's Rule just took about 0.07s for finding a random solution (in the first try) on the 100x100 chessboard.

Margin of Error

Please take a note that the Brute-force and the common backtracking analysis result contains margin of error. The first try result from random starting point is only taken by one arbitrary sample which is not the optimal one. Hence, there may be unfair result occurred.

Source Code License

Licensed under The MIT License . You could use the source code for whatever you want as long as the LICENSE file or the license header in the source code still there.

Documentation License

All reading materials from this repository is licensed under CC BY 4.0 . You could use this repository as your reference as long as you give the attribution.

  • Windows Programming
  • UNIX/Linux Programming
  • General C++ Programming
  • Need help with Knight's Tour recursion a

  Need help with Knight's Tour recursion assignment

knight's tour recursion c

Touropia Logo

Touropia Travel

Discover the World

17 Top Tourist Attractions in Moscow

By Alex Schultz · Last updated on November 3, 2023

The capital of Russia is an incredible place to explore. Visitors to Moscow come away spellbound at all the amazing sights, impressed at the sheer size and grandeur of the city. Lying at the heart of Moscow, the Red Square and the Kremlin are just two of the must-see tourist attractions; they are the historical, political and spiritual heart of the city – and indeed Russia itself.

A fascinating city to wander around, stunning cathedrals, churches, and palaces lie side-by-side with bleak grey monuments and remains from the Soviet state. In addition to its plethora of historical and cultural tourist attractions, Moscow is home to world-class museums, theaters and art galleries.

Renowned for its performing arts, fantastic ballets and amazing circus acts, catching a show while in Moscow is a must. The wealth of brilliant restaurants, trendy bars, and lively nightlife means there is something for everyone to enjoy.

See also: Where to Stay in Moscow

17. Tsaritsyno Palace

Tsaritsyno Palace

Once the summer residence of Catherine the Great, the stunning Tsaritsyno Palace is now a museum-reserve. The architecture is magnificent and there is a lovely park surrounding it for visitors to explore.

Located in the south of Moscow, the palace was commissioned in 1775 and recent renovations mean its lavish interior looks better than ever before with its elegant halls and beautiful staircases.

The exhibits on display look at the life of the empress as well as the history of Tsaritsyno itself. The huge palace grounds are also home to some other delightful buildings with the elegant opera house and wonderful brickwork of the Small Palace being particularly impressive to gaze upon.

VDNKh

Starting out in 1935 as the ‘All-Union Agricultural Exhibition’, VDNKh has slowly morphed over the years into the fascinating open-air museum of today. Remarkably, over 400 buildings can now be found within its confines.

The huge park complex has numerous pavilions representing former Soviet republics on show, such as those of Armenia and Turkmenistan and the distinctive architecture of each of the buildings is always interesting to gaze upon. In addition to this there is the fascinating Memorial Museum of Cosmonautics which is dedicated to space exploration and the fun Moskvarium aquarium even offers you the chance to swim with dolphins.

With lots of eateries scattered about and numerous entertainment options such as horse-riding and zip-lining, there is something for everyone to enjoy; the Friendship of Nations fountain truly is wonderful.

15. Kremlin Armoury

Kremlin Armoury

One of the oldest museums in the city, the Kremlin Armoury has a wealth of treasures; highlights include the ornate Grand Siberian Railway egg, the historic Cap of Monomakh and the stunning Imperial Crown of Russia which often has a crowd of tourists around it, jostling to take a photo.

Once the royal armory, there are loads of fascinating objects on display. Perusing the many sabers, jewelry, armor and more is as interesting as it is educational and entertaining and the swords are so finely crafted that you’ll almost wish you could pick up one and wield if yourself.

Established in 1851, the museum is situated in the Moscow Kremlin.

14. GUM Department Store

GUM Department Store

Standing for ‘Main Universal Store’ in Russian, GUM is stunning. Its wonderful skylights and beautiful facades mean it doesn’t look out of place alongside its illustrious neighbors on Red Square.

With over 200 shops, boutiques and upmarket eateries inside, it is a shopaholic’s heaven and concerned partners will be glad to find more affordable options alongside luxury brands such as Dior and Prada.

The main department store in the city, GUM was opened in 1893. The stunning architecture makes it well worth a visit even if shopping isn’t your thing.

13. Moscow Metro

Moscow Metro

It’s not often that public transport looks like a work of art. So many stops on the Moscow Metro will astound visitors with their beauty and elegance.

Decked in marble and with frescoes covering the walls, the stations are amazing to gaze upon and are part of one of the longest metro systems in the world, with the first stations opened in 1935.

Using the metro is the quickest and easiest way to get around Moscow and braving the crowds of commuters is well worth it for the beauty all around you.

12. Arbat Street

Arbat Street

An elegant yet lively street, Arbat is full of impressive architecture and was once a popular place to live for aristocrats, artists, and academics.

A historic place, it is down Arbat Street that Napoleon’s troops are said to have headed on their way to capture the Kremlin.

Nowadays, there are many cafes, restaurants, and shops, as well as various monuments and statues to former residents such as Alexander Pushkin who was reputed to be a lover of the Russian Empress due to his massive influence in court.

11. Novodevichy Convent

Novodevichy Convent

Drenched in history, the Novodevichy Convent is located in a striking building that was once a fortress. This captivating place is well worth visiting when in Moscow.

Founded in 1524, the convent houses four cathedrals; Smolensk Cathedral is the undoubted highlight due to its delightful 16th-century frescoes.

Wandering around the grounds is like stepping back in time. The Novodevichy Cemetery is where many famous leaders of the Soviet Union are buried, such as Yeltsin and Khrushchev.

10. Pushkin Museum

Pushkin Museum

Despite its name, the Pushkin Museum of Fine Arts actually has no connection at all to the famous poet other than that it was named in his honor after his death. A delight to visit, its extensive collection focuses on European art with masterpieces by Botticelli, Rembrandt, and van Gogh all featuring.

Sculptures, graphic art, paintings and more can be found in its beautiful galleries; various sections look at themes and epochs such as the Renaissance, the Dutch Golden Age, and Byzantine art.

Among the many highlights are the clownish characters which can be found in Cezanne’s Fastnacht (Mardi Gras) and the twirling ballerinas who look so elegant in Degas’ Blue Dancers. Picasso’s Young acrobat on a Ball is also well worth checking out for its interesting use of shapes and colors.

9. Christ The Savior Cathedral

Christ The Savior Cathedral

This gorgeous Russian Orthodox cathedral is located on the banks of the Moskva River, just a stone’s throw away from the Kremlin.

The church as it stands today was consecrated in 2000, as the original church that stood here was destroyed on the command of Josef Stalin in 1931 due to the anti-religious campaign.

With its delightful golden dome, spires and dazzling white facades, the Christ the Savior Cathedral is stunning. The interior is just as captivating to wander around, with its beautifully tiled floors and impressive altar.

8. Lenin Mausoleum

Lenin Mausoleum

Opened to the public in 1924, Lenin’s Mausoleum is one of the most popular tourist attractions in Moscow. The red granite structure is located at the heart of the city in Red Square.

Lenin’s embalmed body lies in a glass sarcophagus; it is a somewhat eerie experience walking past the former leader of the Soviet Union but is well worth doing as you understandably can’t do it anywhere else in the world.

After visiting the mausoleum, head to the Kremlin wall right next to it for more graves of important communist figures such as Stalin and Brezhnev.

7. Tretyakov Gallery

Tretyakov Gallery

Home to the most extensive and impressive collection of Russian fine art in the world, the State Tretyakov Gallery is definitely worth visiting when in Moscow for the wealth of amazing art pieces that it has on display.

Having started out as the private art collection of the Tretyakov brothers, there are now over 130,000 exhibits. Highlights include the iconic Theotokos of Vladimir which you will almost certainly recognise despite probably not knowing the name and Rublev’s Trinity which is considered to be one of highest achievements in Russian art.

An absolute must for art lovers, the State Tretyakov Gallery will delight visitors with all that is has to offer.

6. Kolomenskoye

Kolomenskoye

Once a royal estate, Kolomenskoye is now a museum-reserve and lies a few kilometers outside of the city center. A captivating place to visit, there is a plethora of history on show and the site overlooks the Moskva River.

Consisting of four historical sites, there are extensive gardens for visitors to explore, as well as loads of interesting old buildings, the former village of Kolomenskoye itself and the impressive Palace of the Tsar Alexey Mikhailovich – once considered the Eighth Wonder of the World by contemporaries.

Among the many stunning sights, it is the brilliantly white Ascension Church that is the undoubted highlight – dating back to 1532.

5. Gorky Park

Gorky Park

Lying alongside the Moskva River, the huge Gorky Park is a lovely place to visit. Its extensive gardens are home to numerous cultural institutions and visitors should definitely check out the Garage Museum of Contemporary Art and while the eclectic exhibits may not always feature such incredible sights as a balloon-covered rider on a zebra; they certainly always succeed in pushing back the boundaries of art.

Pop-up exhibitions and festivals can be found from time to time in the park itself and there is an open-air theatre and numerous eateries alongside a plethora of leisure activities.

Whether it’s cycling, table tennis or yoga that you are after or beach volleyball and rowing, Gorky Park certainly has it. In winter, there is a huge ice rink for visitors to enjoy.

4. Bolshoi Theatre

Bolshoi Theatre

The Bolshoi Theatre is the main theater in the country. The amazing opera and ballet performances it has put on over the centuries go a long way in explaining Russia’s rich history of performing arts.

While the Bolshoi Ballet Company was established in 1776, the theater itself was opened in 1825. The glittering, six-tier auditorium is lavishly and decadently decorated; it is a fitting setting for the world-class performances that take place on its stage.

Spending a night watching a performance of such classics as The Nutcracker or Swan Lake at the Bolshoi Theatre is sure to be a memorable experience and the beauty all around you only adds to the sense of occasion.

3. Moscow Kremlin

Moscow Kremlin

This famously fortified complex is remarkably home to five palaces and four cathedrals and is the historic, political and spiritual center of the city. The Kremlin serves as the residence for the country’s president. It has been used as a fort, and this fact is made clear by its sheer size. The Kremlin’s outer walls were built in the late 1400s.

Under Ivan III, better known as Ivan the Great, the Kremlin became the center of a unified Russian state, and was extensively remodeled. Three of the Kremlin’s cathedrals date to his reign that lasted from 1462-1505. The Deposition Church and the Palace of Facets were also constructed during this time. The Ivan the Great Bell Tower was built in 1508. It is the tallest tower at the Kremlin with a height of 266 feet (81 meters).

Joseph Stalin removed many of the relics from the tsarist regimes. However, the Tsar Bell, the world’s largest bell, and the Tsar Cannon, the largest bombard by caliber in the world, are among the remaining items from that era. The Kremlin Armory is one of Moscow’s oldest museums as it was established more than 200 years ago. Its diamond collection is impressive.

The Kremlin’s gardens – Taynitsky, Grand Kremlin Public and Alexander – are beautiful. The Kremlin has also served as the religious center of the country, and there is a tremendous number of preserved churches and cathedrals here. The collections contained within the museums include more than 60,000 historical, cultural and artistic monuments. Those who enjoy the performing arts will want to consider attending a ballet or concert at the State Kremlin Palace. Completed in 1961, it is the only modern building in the Kremlin.

2. Red Square

Red Square

Lying at the heart of Moscow, Red Square is the most important and impressive square in the city. It is one of the most popular tourist attractions due to its wealth of historical sights and cultural landmarks.

Drenched in history, the huge square is home to incredible sights such as the Kremlin, St. Basil’s Cathedral and Lenin’s Mausoleum, among others. Consequently, it is not to be missed when in Moscow as it really is home to the city’s most stunning monuments.

It is here that many important moments in Russian history took place; the former marketplace has hosted everything from Tsar’s coronations and public ceremonies to rock concerts and Soviet military parades. Wandering around the massive square is a humbling experience and undoubtedly one of the highlights the city has to offer.

1. Saint Basil’s Cathedral

Saint Basil's Cathedral

Located in the impressive Red Square, St. Basil’s Cathedral is gorgeous; its delightful spires appear as if out of a fairytale. The most recognizable building in the country, the cathedral is very much a symbol of Russia. No visit to Moscow is complete without having taken in its unique and distinctive features.

Ivan the Terrible ordered the cathedral’s construction in the mid-16th century, and legend holds that Ivan put out the architect’s eyes so that he would be unable to build another cathedral more glorious than St. Basil’s. Designed to resemble the shape of a bonfire in full flame, the architecture is not only unique to the period in which it was built but to any subsequent period. For various reasons, both Napoleon and Stalin wanted to destroy the cathedral but fortunately did not succeed.

Known for its various colors, shapes and geometric patterns, St. Basil’s Cathedral houses nine different chapels that are all connected by a winding labyrinth of corridors and stairways. On the lower floor, St. Basil’s Chapel contains a silver casket bearing the body of St. Basil the Blessed.

Throughout the cathedral are many beautiful murals, frescoes, wooden icons and other art works and artifacts. Outside the cathedral is a lovely garden with the bronze Monument to Minin and Pozharsky, who rallied an all-volunteer Russian army against Polish invaders during a period of the late 16th century known as the Times of Troubles.

Share this post:

knight's tour recursion c

Where to Stay in Moscow

knight's tour recursion c

14 Most Scenic Small Towns In Russia

Regions in Russia

9 Most Beautiful Regions in Russia

knight's tour recursion c

15 Best Cities to Visit in Russia

knight's tour recursion c

10 Most Amazing Destinations in Eastern Russia

Tourist Attractions in Saint Petersburg

15 Best Attractions & Things to do in Saint Petersburg, Russia

Best Places to Visit in Russia

10 Best Places to Visit in Russia

knight's tour recursion c

10 Top Tourist Attractions in Russia

knight's tour recursion c

10 Best Mauritius Luxury Resorts

knight's tour recursion c

10 Most Beautiful National Parks in Uganda

IMAGES

  1. Knight Tour in Chess Board || C++ || Recursion and BackTracking

    knight's tour recursion c

  2. Knights Tour

    knight's tour recursion c

  3. Knight's tour Implementation without graphic in C++

    knight's tour recursion c

  4. Lecture 24 Knight's Tour Problem

    knight's tour recursion c

  5. Knight Tour Problem Backtracking (Data Structures and Algorithms #8)(Recursion #5)(Backtracking #4)

    knight's tour recursion c

  6. The Knight’s Tour. Recursion is an extremely powerful…

    knight's tour recursion c

VIDEO

  1. Learn how to perform the Knight's Tour

  2. Mã Đi Tuần

  3. First Practice Match of 2024

  4. ⚔️King Arthur: Knight's Tale🔊 Релиз полной версии. Пошаговая игра. Часть №2

  5. Прохождение Star Wars: KotOR 2 TSLRCM #34 Дксун Гробница Фридона Надда

  6. ⚔️King Arthur: Knight's Tale🔊 Релиз полной версии. Пошаговая игра. Часть №6

COMMENTS

  1. The Knight's tour problem

    Backtracking Algorithm for Knight's tour . Following is the Backtracking algorithm for Knight's tour problem. If all squares are visited print the solution Else a) Add one of the next moves to solution vector and recursively check if this move leads to a solution. (A Knight can make maximum eight moves. We choose one of the 8 moves in this step).

  2. Knight's Tour recursive problem

    As a little bit of background, the Knight's Tour is a sequence of moves by a knight (that is, the chess piece) that will visit every square exactly once. The program is supposed to output a matrix of non-repeating numbers, from 1 to the number of squares on the board, because the "knight" leaves a non-zero number on each square it has visited.

  3. Knight's tour problem using backtracking and its analysis

    We have to start the KNIGHT-TOUR function by passing the solution, x_move and y_move matrices. So, let's do this. As stated earlier, we will initialize the solution matrix by making all its element -1. for i in 1 to N. for j in 1 to N. sol[i][j] = -1. The next task is to make x_move and y_move arrays.

  4. knights tour in c++ using recursion

    knights tour in c++ using recursion. Ask Question Asked 10 years, 1 month ago. Modified 2 years, 3 months ago. Viewed 920 times 0 I have created a class Board which deals with 2d vectors specifically for this purpose. I am trying to solve the Knight's Tour. I want to print out the thing when it is done.

  5. The Knight's Tour. Recursion is an extremely powerful…

    Knight's graph showing all possible paths for a knight's tour on a standard 8 × 8 chessboard. The numbers on each node indicate the number of possible moves that can be made from that position.

  6. Backtracking

    A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed, otherwise it is open.

  7. PDF An efficient algorithm for the Knight's tour problem

    Fig. 4. A 16 x 16 knight's tour constructed from the 8 x 8 knight's tour in Fig. 2 using the technique of Theorem 2. I. The algorithm of Theorem 2.1 is particularly easy to implement, and can be used to construct knight's tours of size up to 1000 x 1000 in under 11 s on a SUN SPARC 2.

  8. A recursive solution to the popular Knight's Tour problem written in

    A recursive solution to the popular Knight's Tour problem written in both Java and C++. The Knight's Tour is a mathematical problem involving a knight and a chessboard. It is a calculated sequence of moves where the knight visits each square only once. If the knight finishes on the same squarewhich it began, the tour is closed.

  9. Knight Tour Problem Backtracking (Data Structures and ...

    This video explains how to solve famous knight tour problem from backtracking in recursion. Many variations of this problem are being asked in Microsoft, Goo...

  10. 9.13. Implementing Knight's Tour

    At this point we change the color of node C back to white. The call to knightTour returns a value of False. The return from the recursive call effectively backtracks the search to vertex B (see Figure 6). The next vertex on the list to explore is vertex D, so knightTour makes a recursive call moving to node D (see Figure 7).

  11. 9.13. Implementing Knight's Tour

    At this point we change the color of node C back to white. The call to knightTour returns a value of False. The return from the recursive call effectively backtracks the search to vertex B (see Figure 6). The next vertex on the list to explore is vertex D, so knightTour makes a recursive call moving to node D (see Figure 7).

  12. GitHub

    First, edit the part of n variable which is denoting the chessboard. As an example, edit it to this code below. int n; scanf ( "%d", &n); Compile the source code into an executable file. I assume that we using the *NIX family operating system and g++ compiler. g++ implementation-name.cpp -std=c++11 -o exe.

  13. Need help with Knight's Tour recursion a

    If an illegal move is made, then the program is to switch to another move and determine if it would be legal from the 8 possible moves a knight can make. The move switching sequence would be counterclockwise. So on a 5x5 board, with the knight starting on the uppermost left square, the knight's tour should go like this: 1 6 15 10 21.

  14. Moscow City Council

    The agenda and packet for this meeting are available at http://www.ci.moscow.id.us/AgendaCenter

  15. A shaurma shop with Moscow City in the background. : r/Cyberpunk

    223 votes, 10 comments. 870K subscribers in the Cyberpunk community. A genre of science fiction and a lawless subculture in an oppressive society…

  16. Night Walking Tour

    🎧 Wear headphones for the best experience.In this video you will enjoy a quiet night walk surrounded by beautiful modern skyscrapers of the Moscow City Inte...

  17. debugging

    1. Your moveKnight function returns immediately because it determines the very first position is not a valid move. The reason is you initialized the board with a non-zero value at the start position. Remove these two lines from main: board[startx][starty] = 1; movecount + 1;

  18. 17 Top Tourist Attractions in Moscow

    Completed in 1961, it is the only modern building in the Kremlin. 2. Red Square. Lying at the heart of Moscow, Red Square is the most important and impressive square in the city. It is one of the most popular tourist attractions due to its wealth of historical sights and cultural landmarks.

  19. java

    Removing that line allowed it to complete normally in 19 moves at cell 1, 2. According to the definition of Knight's Tour, that is 1 attack move away from the cell you started at (0, 0) and so represents a complete tour. Your fsize of 5 may not complete, according to Wikipedia. I used 6 instead for testing.