Quick sort algorithm, with ascending order as an example
Operating system: Ubuntu
Compiling software: GCC
Results screenshot:
Source:
#include void quickSort (int *,int,int);
int findposs (int *,int,int);
int main () {int i;
The sword refers to the last question on offer, and a recursive function has been tuned for an afternoon to get the correct result.
Topic Description:
Given a tree, it also gives two nodes in the tree, and asks for their lowest common ancestor.
Topic Description:
Enter a positive integer array that combines all the numbers in the array into a number, printing the smallest of all the numbers that can be spliced. For example, enter the array {3,32,321}, and print out the smallest number
Full sort:
Take M (m≤n) elements from n different elements and arrange them in a certain order, called an arrangement of taking m elements from n different elements. All permutations are called when m=n. For example n=3, the whole sort is: 123, 132,
Binary tree is a very important data structure, many other data organizations are based on the binary Tree Foundation evolved. The binary tree has the front, the middle, and the last three ways to traverse, because the tree itself is defined by
arbitrage:http://poj.org/problem?id=2240
Effect:
Give you m currency, give you m currency exchange rules, ask whether through these rules can finally make a profit. Eg:1 dollar for 0.5 pounds, 1 pounds for 10 francs, 1 francs for 0.21 dollars, so
Currency exchange:http://poj.org/problem?id=1860
The effect: There are a variety of currencies, can be exchanged between, but the need for fees, that is, both exchange rates and handling charges. Ask if you can make money after the exchange.
Train
Flesch Reading ease:http://poj.org/problem?id=3371
The topic is very water, is to read the question on line.
Meaning
Give a normative article, ask its sentence number, word number and syllable number to put these 3 values into the title given
area:http://poj.org/problem?id=1265
To give you a point of the horizontal ordinate change value, ask how many points in the polygon, how many points in the polygon, and the area of the polygon.
Idea: Pick theorem.
A polygon area formula for
toys:http://poj.org/problem?id=2318
To give you a box, there are n panels separated into n+1 parts, give you the coordinates of the M toy, ask each part has several toys.
Train of thought: to each toy, the two-segment subscript, judge the toy in
HDU 2985:http://acm.hdu.edu.cn/showproblem.php?pid=2985
Effect:
To you n individual, each person buys the M time lottery ticket, the first time bonus is 2 I second side, asks each person to win more than other people's likelihood is many.
Ideas:
POJ 3792:http://poj.org/problem?id=3792
Effect:
In order to give you a bunch of cubes, if the current input of the cube before and after the upper and lower sides are not connected with the previous cube, output no, and output is currently the
POJ 2653:http://poj.org/problem?id=2653
The idea is very simple, that is, on the ground in order to sprinkle a pair of sticks, to see how many are finally pressed, the output is not pressed the number of the stick. A bit of a pit is not clear how
HDU 1174:http://acm.hdu.edu.cn/showproblem.php?pid=1174
The main idea: Chinese problem, very good understanding, make clear various variables on the line.
Train of thought: I know there seems to be two solutions, one is to seek the head of the
Preprocessing the number of sub nodes of each node sons, then the query to X can be obtained by sons[x]-Sigma (Sons[v) (V is the point to X distance to D)
How to find these v quickly? Notice that the point from X to D is definitely on the same
#include void Main () {//00-11-22-33 the first slash is the second 10-21-32 int arr2[4][4] =
{00, 01, 02, 03, 10, 11, 12, 13, 20, 21, 22, 23,
30, 31, 32, 33,};
int I, J;
int sum = 0;
int
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.