运行结果为:[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]] ...
分类:
编程语言 时间:
2019-10-13 15:33:18
阅读次数:
98
Math类 取绝对值:(Math.abs(-8)); 结果为比参数值大的最小整数的double值:(Math.ceil(12.5)); 结果为比参数值小的最大整数的double值:(Math.floor(12.4)); 返回两个参数值中较大的值:(Math.max(5, 5.1)); 返回第一个参数 ...
分类:
其他好文 时间:
2019-10-11 12:36:37
阅读次数:
92
分治法: 1. 将问题拆分为几个子问题,并且这些子问题和原问题相似只是量级上小一些。 2. 递归地解决每一个子问题,然后结合这些子问题的解决方案构造出原问题的解决方案。 我们已经遇到过的问题: 1. 二分搜索 2. 归并排序 3. 快速排序 分治法例子: 练习1:快速指数: 能够快速计算出a的n次方 ...
分类:
编程语言 时间:
2019-10-08 23:58:47
阅读次数:
195
一,栈的定义 ? 栈:是限定在表尾进行插入或删除操作的线性表。 ?对栈来说,一般将表尾称为栈顶(top),表头端称为栈底(base)。不含元素的空表称为空栈。 ? 栈的修改是按后进先出的原则进行的,因此,栈又称为后进先出的线性表。 二,栈的表示与实现 顺序栈:即栈的顺序存储结构是利用一组地址连续的存 ...
分类:
其他好文 时间:
2019-10-08 12:35:16
阅读次数:
92
前言Java为我们提供了几种排序得方法,比如Arrays和Collections类,但是前提是数组或者集合中的元素都必须实现Comparable接口,基本的数据类型都已经实现了Comparable接口了,所以我们才能够直接对基本类型的数组或者集合进行排序,比如Float和Integer类得源码.今天 ...
分类:
编程语言 时间:
2019-10-05 12:58:47
阅读次数:
97
Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique. Exam ...
分类:
其他好文 时间:
2019-10-05 10:24:33
阅读次数:
78
We are given two arrays and of words. Each word is a string of lowercase letters. Now, say that?word is a subset of word if every letter in occurs in ...
分类:
其他好文 时间:
2019-10-05 00:40:31
阅读次数:
110
The shape attribute for numpy arrays returns the dimensions of the array. If Y has n rows and m columns, then Y.shape is (n,m). So Y.shape[0] is n. nu ...
分类:
编程语言 时间:
2019-10-04 19:22:08
阅读次数:
135