数据结构
一口桃子酒
这个作者很懒,什么都没留下…
展开
-
2020-10-11
第三章 栈与队列 1:滑动窗口 描述 给定一个长度为n(n<=10^6)的数组。有一个大小为k的滑动窗口从数组的最左端移动到最右端。你可以看到窗口中的k个数字。窗口每次向右滑动一个数字的距离。 下面是一个例子: 数组是 [1 3 -1 -3 5 3 6 7], k = 3。 窗口位置 最小值 最大值 [1 3 -1] -3 5 3 6 7 -1 3 1 [3 -1 -3] 5 3 6 7 -3 3 1 3 [-1 -3 5] 3 6 7 -3 5 1 3 -1原创 2020-10-11 14:12:18 · 1034 阅读 · 0 评论 -
Number Sequence
Number Sequence 描述 A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2…Sk. Each group Sk consists of a sequence of positive integer numbers ranging from 1 to k, written one原创 2020-10-03 23:15:57 · 337 阅读 · 0 评论 -
多项式加法(线性表
多项式加法(线性表) 描述 我们经常遇到两多项式相加的情况,在这里,我们就需要用程序来模拟实现把两个多项式相加到一起。首先,我们会有两个多项式,每个多项式是独立的一行,每个多项式由系数、幂数这样的多个整数对来表示。 如多项式2x20- x17+ 5x9- 7x7+ 16x5+ 10x4 + 22x2- 15 对应的表达式为:2 20 -1 17 5 9 - 7 7 16 5 10 4 22 2 -15 0。 为了标记每行多项式的结束,在表达式后面加上了一个幂数为负数的整数对。 同时输入表达式的幂数大小顺序是原创 2020-10-03 22:01:31 · 754 阅读 · 0 评论