Java classic question Summary

Source: Internet
Author: User
1. Explanation of the question of the length of a Series: As a european mathematician in the 1200 s, Fibonacci mentioned in his book: If a rabbit produces a rabbit every month, A month later, the rabbit began to produce. At first, there was only one rabbit, two rabbits in a month, three rabbits in two months, and five rabbits in three months )......
  
2. Pascal's triangle (Pascal) Problem description: Pascal's triangle is basically solving NCR, because each number on the triangle corresponds to a NCR, where n is row, R is colnmu
  
3. threecolorflags. w. according to Dijkstra, the term used by the tower is Dutch nation flag (Dijkstra is Dutch), while most authors use three-color flag. Suppose there is a rope with red, white, and blue flags on it. At first, there is no sequence of flags on the rope, the red sequence requires the least number of moves. Note that you can only perform this operation on the rope, and only two flags can be exchanged at a time.
  
4. The mouse follows the maze. The mouse follows the maze, which is the basic type of circular solution. We use 2 in a two-dimensional array to represent the wall of the maze, use 1 to represent the walking path of the mouse, and use the program to find the distance from the entrance to the exit.
  
5. The knight took the Board (Knight tour) Problem description: In the 18th century, the knight game attracted the attention of mathematicians and puzzles. The Knight's way was to play the chess game, the server guard can start from any position and how it can finish all the positions.
  
6. Explanation of the eight Queens: the queens in chess can go straight forward and eat all the pawns they encounter. If there are eight queens on the board, then how can these eight queens be securely placed on the board?
  
7. Description of the eight silver coins (coins): there are now eight silver coins abcdefg. It is known that one of them is a counterfeit coin, and its weight is different from the real coin, but I do not know whether it is light or heavy, how can I use the balance to determine whether a counterfeit currency is lighter or heavier than a real coin with the minimum number of comparisons.
  
8. Life Game Problem description: Life game, a British mathematician J. h. conway proposed that the neighbors of a cell include the upper, lower, left, right, upper left, lower left, and upper right adjacent cells in the lower right. The rules of the game are as follows: 1. Death alone: if the cell neighbor is smaller than one, the Cell will die in the next state. 2. Crowded death: if there are more than four cell neighbors, the Cell will die in the next state. 3. Stable: if the cell neighbor is two or three, the cell remains stable in the next state. 4. resurrection: If there are no cells in the original position, and there are three neighbors in the position, the same cell will be revived.
  
9. String Match Problem description: currently some advanced programming languages support more and more string processing, but string search is still worth exploring, here, the Boyer Moore method is used to describe how to use strings. This method is fast and easy to understand.
  
10. hanoi2colors: towers of Hanoi is French M. claus (Lucas) was taken from Thailand to France in 1883, and the river is the capital of the Vietnam war, now the Ho Chi Minh City. In 1883, the French mathematician Edouard Lucas mentioned this story, it is said that at the time of creation, Benares had a polo Church, which was supported by three diamond bars (PAG, at the beginning, God placed 64 gold disks (disc) arranged from top to bottom in ascending order on the first stick ), and ordered the monks to move all the gold disks from the first stone rod to the third stone rod, and observe the principle that the big plate is under the Small Plate during the handling process. If only one plate is moved every day, when the plate is fully moved, the tower will be damaged, that is, the end of the world.
  
11. About a backpack (kanpsack problem): Suppose a backpack can carry a maximum of 8 kilograms of weight, and you want to put the maximum value of weight in the backpack.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.