Algorithm 1 (Multi-border area, polygon direction, flood-fill, Floyd-warshall algorithm, short circuit problem

Source: Internet
Author: User
Algorithm 1 (Multi-border area, polygon direction, flood-fill, Floyd-warshall algorithm, short circuit problem

1) multi-layered Area
Bytes

The multidimensional representation of a pair (in reverse chronological order) is as follows:

If the data is sorted by hour, you can obtain the hour number.

For the multi-dimensional shapes described by the attention margin and the outer angle, the surface is as follows:

The following n-grams of S = Σ [(-1) ^ K * mnsin θ]/2 represent n-grams of known (N-1) the length of each vertex and the angle of any two of them. The half after the sum of these two elements (-1) ^ K * mnsin θ is the surface attention: k = 0 or 1. The purpose is to indicate that the positials of each form of mnsin θ are related to the locations of M and N.

2) determine whether a single point is in a convex multi-layered internal shot Rendering Algorithm
Polygon filling polygon, flood fill algorithm, (scanline fill algorithm), fill in a single multi-: http://alienryderflex.com/polygon_fill. The principle is the same as that of the point in polygon algorithm. Another common method is to triangle a single number of operators, fill in the corresponding fields for each triangle ., Extended Parallel Execution: Pick's Theorem
Http://www.csie.ntnu.edu.tw /~ U91029/polygon.html

3) Determine whether the direction of the polygon is clockwise or counterclockwise.
Bytes.

4) flood-fill Seed Filling
Http://hi.baidu.com/richardma_/blog/item/d688828b9e29c9be0f2444a9.html
Problem description
Given a vertex, a graph, the algorithm aims to replace the color of the vertex and its surrounding color points with a certain color.

Algorithm Description

Flood-fill (point coordinate, target color, replace color)
1. Exit if the color on the coordinate is not the target color
2. Set the coordinate point to the replacement color.
3. recursively call flood-fill to fill the left Coordinate
Recursively call flood-fill and fill in the right coordinate
Recursively call flood-fill and fill in the coordinates above
Recursively call flood-fill and fill the coordinates below
4. Return

5) The Floyd-warshall algorithm (Floyd-warshall algorithm) is an algorithm used to solve the shortest circuit at any two points, it can be used to solve the shortest problem with the permission of the attacker or the attacker.
Http://zh.wikipedia.org/zh-hk/%E5%BC%97%E6%B4%9B%E4%BC%8A%E5%BE%B7%E7% AE %97%E6%B3%95

The principle of the Floyd-warshall algorithm is to perform dynamic scheduling.

SetDI,J,KFromIToJOnly (1 ..K) The distance in the set is the length of the shortest path of the middle distance.

  1. If the shortest path is over KDI,J,K=DI,K,K− 1 +DK,J,K− 1;
  2. If the shortest path is less than KDI,J,K=DI,J,K−1.

Therefore,DI,J,K= Min (DI,K,K− 1 +DK,J,K−1,DI,J,K− 1 ).

In the real algorithm, an iteration can be performed directly on the original space to reduce the space to two degrees. (See the following algorithm description)

[Algorithm description] Algorithm Description

The Floyd-warshall algorithm is described as follows:

for k  1 to n do
for i 1 to n do
for j 1 to n do
if (Di,k + Dk,j < Di,j) then
Di,j Di,k + Dk,j;

WhereDI,JIndicates the Starting PointITo pointJWhenDI,J∞ Indicates that there is no protocol between the two points.

6) Dijkstra Algorithm

7) transient problem
Http://zh.wikipedia.org/zh-hk/%E5%9B%BE%E8% AE %BA%E6%9C%80%E7%9F%AD%E8%B7%AF

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.