基数排序是一种借助多关键字排序的思想对单逻辑关键字进行排序的方法。实现的过程不需要之前的所有排序所需要的记录关键字比较,移动等操作。
多关键字排序:
多关键字排序通常有两种方法:
1、MSD(Most Significant Digit)法,最高为优先法
2、LSD(Least Significant Digit)法,最低位优先法过程借助分配,收集两种操作。数组基数排序:过程演示:第一步...
分类:
编程语言 时间:
2015-06-21 09:30:28
阅读次数:
197
#include #include int main(){ int T, N, i, j; int a[10]; scanf("%d", &T); while (T--) { memset(a, 0, sizeof(a)); scanf("%d", &N); for (i = 1; i 0)...
分类:
其他好文 时间:
2015-06-21 00:47:44
阅读次数:
153
#include int main(){ int T, N, i, k, digitsum, generator; scanf("%d", &T); while (--T >= 0) { scanf("%d", &N); for (i = 45; i > 0; --i) { generat...
分类:
其他好文 时间:
2015-06-20 23:21:31
阅读次数:
134
把前n(n<=10000)个整数顺次写在一起:123456789101112…数一数0~9各出现多少次(输出10个整数,分别是0, 1, …, 9出现的次数)。#include
#include #define maxn 10000char s[maxn];
int act[10];int main()
{
int i;
while(scanf...
分类:
其他好文 时间:
2015-06-18 19:48:09
阅读次数:
139
1000-digit Fibonacci number
Problem 25
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn?1 + Fn?2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F...
分类:
编程语言 时间:
2015-06-18 09:52:36
阅读次数:
175
题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is...
分类:
其他好文 时间:
2015-06-17 23:23:03
阅读次数:
277
For a positive integer N , the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of N , we call N a generator of M .For example, the digit-sum of 245 is 256 (= 245...
分类:
其他好文 时间:
2015-06-17 21:40:45
阅读次数:
220
刚开始在POJ上刷题。。。。先水几道题,嘿嘿
Description
Find and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of its digits when represent...
分类:
其他好文 时间:
2015-06-17 13:31:53
阅读次数:
129
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon...
分类:
其他好文 时间:
2015-06-14 21:13:20
阅读次数:
125
#include #include int main(){ int i,sum,sumOfH,sumOfd,tmp1,tmp2,tmp3; for(i=2992;i<10000;i++) { sum=0; sumOfd=0; sumOfH=...
分类:
其他好文 时间:
2015-06-11 18:55:40
阅读次数:
135