Heap sorting details

1. Definition of heap sorting N key word sequences KL, K2 ,..., Kn is called a heap, and only when the sequence meets the following properties (referred to as heap properties ): (1) KI ≤ k2i and Ki ≤ k2i + 1 or (2) KI ≥ k2i and Ki ≥ k2i + 1 (1 ≤ I ≤

HDU 2159 (full backpack)

Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2159  # Include # Include # Define max (A, B) A> B? A: B Using namespace STD; Int DP [105] [105]; Struct page { Int W; Int V; } PG [105]; Int main (){ Int n, m, K, S, I, j, h; While (~ Scanf ("% d", &

HDU 2896 virus attack (AC)

Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2896 This question has been wa for many times, about 8 or 9 times. From CF to half, we started to adjust it here. After unremitting efforts, we finally found that the memset of TMD and VIS was

Poj 3256 cow Picnic (DFS)

Http://poj.org/problem? Id = 3256 Store the paths of N farms in an adjacent table, record the initial number of cattle in each farm, and query the number and number of cattle in each farm along the path DFS. Code:# Include # Include Using

Poj 2251 Dungeon Master (BFS)

Http://poj.org/problem? Id = 2251 Refreshing questions! But don't use all the RP as xcy said... The BFS of 3D space only requires two more directions for searching. Code:# Include # Include Bool vis [31] [31] [31]; Int lve [6] = {1, 0, 0, 0, 0,-1 }

Zoj 2058 the archaeologist's trouble II

Http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemcode = 2058. A simple regular question. The two adjacent characters in each line must be different. When a row starts from 1, the '@' and '*' of an even number of rows must be half of each

Poj 2485 highways (prim)

Http://poj.org/problem? Id = 2485 The question is not difficult. The question is very difficult... I have read it several times or I am confused! Is to find the maximum edge weight in the Minimum Spanning Tree, take poj1287 and change it, decisive

Directed edge adjacent linked list Storage

# Include # Include # Include Using namespace STD; Const int nmax= 1000; Class edge { Public: Int V, NEX; }; Edge e [Nmax]; Int N, K, head [Nmax]; // head [I] is the head of the linked list starting from vertex I. Void addedge (int A, int B) {//

Poj 3009 curling 2.0 (DFS)

Http://poj.org/problem? Id = 3009 In fact, at the beginning, we wanted to use dir as a parameter and search based on the map condition, but it was processed with while in recursion. It was hard to process the backtracking of map from 0 to 1. The

Poj 1226 substrings (suffix array)

Http://poj.org/problem? Id = 1226 Returns the maximum public substring of the given string and Its substring. Suffix array, which connects all strings and Their substrings, separates them with delimiters, and marks the strings of each string and Its

Zoj 1089 lotto

Http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemcode = 1089. Recursive arrangement and combination. Code:# Include Int data [20]; Int ans [6], N; Void work (INT diex, int aiex ){ Int I; If (aiex = 6 ){ For (I = 0; I Printf ("% d", ANS [I]);

Poj 1159 palindrome (DP)

Http://poj.org/problem? Id = 1159 The question of the card memory is even more disgusting! If you use the int type to submit a message, you can only change it to short int, 65128 kb,Memory limit:65536k... indicates that it is speechless. The

Poj 2823 sliding window (monotonous Queue)

Http://poj.org/problem? Id = 2823 The input speed was used for purely monotonous queue exercises. The results showed that scanf was not as fast as scanf... It was said that some time ago when we were doing monotonous optimization, we had some point

Poj 3600 subimage recognition (enumeration + DFS)

Http://poj.org/problem? Id = 3600 Enumerate the position of the first row of subimage in the image, and then select column C in the image. If the column C contains the same row of R and subimage, there is a solution. Code:# Include # Include #

Poj 1222 & zoj 1354 extended lights out (enumeration)

Http://poj.org/problem? Id = 1222 Similar to poj 1753, 1753 is the number of steps for full 0 or full 1. This is a solution for full 0. At that time, I changed the code by 1753. The number of enumeration steps is up to 30 steps. In this case, the

HDU 2199 can you solve this equation? (Binary)

Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2199 The simple binary search should belong to the water question... the Tangle is that the example has not passed, and the AC is a try. These two days are too bad, so I feel overwhelmed when so many

Poj 2752 seek the name (KMP)

Http://poj.org/problem? Id = 2752 The next Array application of KMP. In a word, next [J] must be the maximum value that satisfies STR [1 .. next [J] = STR [J-next [J] + 1. J.   Take abababa as an example. If next [7] = 5, STR [1 .. 5] = STR [3 .. 7],

Poj 2406 & poj 1961 (KMP)

Poj2406http: // poj.org/problem? Id = 2406 Given a string, the maximum number of identical substrings cannot be overlapped.   The next Array application of KMP. How can we determine whether such a substring exists and the number of substrings. The

ToJ 1180 stone game

Http://acm.timus.ru/problem.aspx? Space = 1 & num = 1180 Simple reasoning game. Observe the number to be retrieved at a time, such as 1, 2, 4, 8, 16 ..., the remainder of 3 is 1, 2, 2, 1 ..., that is to say, it is impossible to use only one

Poj 1564 & zoj 1711 sum it up (DFS)

Http://poj.org/problem? Id = 1564 Http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemcode = 1711. Simple Deep Search, mainly this sentence if (! Vis [I] & Data [I] Ensure that two consecutive identical numbers only have one chance to enter

Total Pages: 64722 1 .... 55435 55436 55437 55438 55439 .... 64722 Go to: GO

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.