上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
摘要: 奇偶排序,或奇偶换位排序,或砖排序,是一种相对简单的排序算法,最初发明用于有本地互连的并行计算。这是与冒泡排序特点类似的一种比较排序。该算法中,通过比较数组中相邻的(奇-偶)位置数字对,如果该奇偶对是错误的顺序(第一个大于第二个),则交换。下一步重复该操作,但针对所有的(偶-奇)位置数字对。如此交替进行下去。处理器数组的排序在并行计算排序中,每个处理器对应处理一个值,并仅有与左右邻居的本地互连。所有处理器可同时与邻居进行比较、交换操作,交替以奇-偶、偶-奇的顺序。该算法由Habermann在1972年最初发表并展现了在并行处理上的效率。该算法可以有效地延伸到每个处理器拥有多个值的情况。在Bau 阅读全文
posted @ 2013-08-01 22:24 cpoint 阅读(714) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序(Bubble Sort)是一种简单的排序算法。它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序完成。这个算法的名字由来是因为越小的元素会经由交换慢慢“浮”到数列的顶端。冒泡排序对个项目需要O()的比较次数,且可以原地排序。尽管这个算法是最简单了解和实作的排序算法之一,但它对于少数元素之外的数列排序是很没有效率的。冒泡排序是与插入排序拥有相等的执行时间,但是两种法在需要的交换次数却很大地不同。在最坏的情况,冒泡排序需要次交换,而插入排序只要最多交换。冒泡排序的实现(类似下面)通常会对已 阅读全文
posted @ 2013-08-01 15:33 cpoint 阅读(396) 评论(0) 推荐(0) 编辑
摘要: 在计算机科学与数学中,一个排序算法(Sorting algorithm)是一种能将一串数据依照特定排序方式的一种算法。最常用到的排序方式是数值顺序以及字典顺序。有效的排序算法在一些算法(例如搜索算法与合并算法)中是重要的,如此这些算法才能得到正确解答。排序算法也用在处理文字数据以及产生人类可读的输出结果。基本上,排序算法的输出必须遵守下列两个原则:输出结果为递增串行(递增是针对所需的排序顺序而言)输出结果是原输入的一种排列、或是重组虽然排序算法是一个简单的问题,但是从计算机科学发展以来,在此问题上已经有大量的研究。举例而言,冒泡排序在1956年就已经被研究。虽然大部分人认为这是一个已经被解决的 阅读全文
posted @ 2013-08-01 15:13 cpoint 阅读(1282) 评论(0) 推荐(0) 编辑
摘要: The following iterative sequence is defined for the set of positive integers: nn/2 (nis even)n3n+ 1 (nis odd)Using the rule above and starting with 13, we generate the following sequence:134020105168421It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although 阅读全文
posted @ 2013-07-28 13:19 cpoint 阅读(439) 评论(0) 推荐(0) 编辑
摘要: It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square. 9 = 7 + 21215 = 7 + 22221 = 3 + 23225 = 7 + 23227 = 19 + 22233 = 31 + 212It turns out that the conjecture was false.What is the smallest odd composite that cannot be written 阅读全文
posted @ 2013-07-27 00:00 cpoint 阅读(254) 评论(0) 推荐(0) 编辑
摘要: We shall say that ann-digit number is pandigital if it makes use of all the digits 1 tonexactly once. For example, 2143 is a 4-digit pandigital and is also prime.What is the largestn-digit pandigital prime that exists? 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 bool ispri. 阅读全文
posted @ 2013-07-26 20:03 cpoint 阅读(366) 评论(0) 推荐(0) 编辑
摘要: The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.Find the sum of the only eleven primes that are both 阅读全文
posted @ 2013-07-26 19:12 cpoint 阅读(356) 评论(0) 推荐(0) 编辑
摘要: The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.How many circular primes are there below one million?#include #include #include #inclu 阅读全文
posted @ 2013-07-26 13:19 cpoint 阅读(333) 评论(0) 推荐(0) 编辑
摘要: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.What is the 10 001st prime number? 1 #include 2 #include 3 #include 4 #include 5 6 int prim(int n) 7 { 8 int i; 9 for(i=2; i*i<=n; i++)10 {11 if(n%i==0)12 return 0;13 ... 阅读全文
posted @ 2013-07-26 11:27 cpoint 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that isevenly divisibleby all of the numbers from 1 to 20? 1 #include 2 #include 3 #include 4 #include 5 6 #define N 20 7 8 int gcd(int a, int b) 9... 阅读全文
posted @ 2013-07-26 11:26 cpoint 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
浏览次数:travelocity promotion codes