
挑战程序和数据结构
挑战程序和数据结构 题解
zqhf123
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ALDS1_3_D-Areas on the Cross-Section Diagram(区域的横截面图)
Areas on the Cross-Section Diagram Your task is to simulate a flood damage. For a given cross-section diagram, reports areas of flooded sections. Assume that rain is falling endlessly in the region a...原创 2020-04-16 10:54:27 · 429 阅读 · 0 评论 -
ALDS1_3_C-Doubly Linked List
Doubly Linked List Your task is to implement a double linked list. Write a program which performs the following operations: insert x: insert an element with key x into the front of the list. delete x:...原创 2020-04-16 10:50:41 · 243 阅读 · 0 评论 -
ALDS1_3_B-Queue(队列)
There are n processes in a queue. Each process has namei and timei. The round-robin scheduling handles the processes in order. A round-robin scheduler gives each process a quantum (a time slot) and in...原创 2020-04-16 10:48:08 · 270 阅读 · 0 评论 -
ALDS1_3_A stack (栈)
Reverse Polish notation is a notation where every operator follows all of its operands. For example, an expression (1+2)*(5+4) in the conventional Polish notation can be represented as 1 2 + 5 4 + * i...原创 2020-04-16 10:44:55 · 351 阅读 · 0 评论 -
ALDS1_1_C-Prime Numbers
Prime Numbers A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program whi...原创 2020-04-16 10:41:24 · 264 阅读 · 0 评论 -
ALDS1_1_B-Greatest Common Divisor(最大公约数)
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers a and b Input a and b are given in a line sparated by a single space. Output Output the greatest ...原创 2020-04-16 10:37:43 · 436 阅读 · 0 评论 -
ALDS1_2_D-Shell Sort
Shell Sort(希尔排序) Shell Sort is a generalization of Insertion Sort to arrange a list of n elements A. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 ...原创 2020-04-16 10:31:51 · 241 阅读 · 0 评论 -
ALDS1_2_C-Stable Sort(稳定排序)
Stable Sort Let’s arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, … 9). For example, ‘eight of heart’ is represented by H8 and ‘one of diamonds’ is repre...原创 2020-04-16 10:29:35 · 262 阅读 · 0 评论 -
ALDS1_2_B-Selection Sort
Selection Sort Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A...原创 2020-04-16 10:25:34 · 237 阅读 · 0 评论 -
ALDS1_2_A-Bubble Sort
Bubble Sort Write a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1...原创 2020-04-16 10:23:23 · 171 阅读 · 0 评论 -
ALDS1_1_A-Insertion Sort
Insertion Sort Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i...原创 2020-04-16 10:20:34 · 235 阅读 · 0 评论 -
Maximum Profit
Maximum Profit You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you...原创 2020-02-07 20:54:30 · 161 阅读 · 0 评论 -
二分 ALDS1_4_B
Search II You are given a sequence ofnintegers S and a sequence of differentqintegers T. Write a program which outputs C, the number of integers in T which are also in the set S. Input In the f...原创 2020-02-07 20:40:57 · 184 阅读 · 0 评论