- 更小的通常更好,但是不要低估了数据的使用范围
- 简单就好
- 整型比字符操作代价更低(字符集的排序和校对很复杂)
- 使用mysql内建的类型而不是字符串来存储时间
- 用整数来存储IP
- 尽量避免NULL
- NULL列很难优化,索引,索引统计和值比较都很复杂
- NULL列会使用更多的空间
| int size = 60; | |
| float x = 0; | |
| color bgColor = #267598; | |
| color fillColor = #77C5E8; | |
| color strokeColor = #A6E2FC; | |
| int stroke = size / 10; | |
| int dir = -1; | |
| int numBubbles = 5; | |
| float[] y = new float[numBubbles]; |
结构体和枚举是为了充分利用Rust编译时的类型检查来在程序范围内创建新类型的基本组件。
struct 是一个允许我们命名并将多个相关值包装进一个有意义的组合的自定义类型。
有点类似python新加入的数据类(其实是python学人家(kotlin的吧 PEP数据类 不过python的是用类装饰器实现的语法糖而已,要配合类型标记使用。
| /**原地归并排序 | |
| * Created by dispensable on 16/7/13. | |
| */ | |
| public class MergeSort { | |
| private static Comparable[] aux; | |
| public static void merge(Comparable[] a, int lo, int mid, int hi) { | |
| int i = lo; | |
| int j = mid+1; |
| # _*_coding:utf-8_*_ | |
| # !/usr/bin/env python | |
| """ | |
| 给出一个整型数字,返回代表该值的英文 | |
| 范围为[0, 1000) | |
| 思路: | |
| 首先判断是否是不规则读法; | |
| 其次考虑两位数读法; | |
| 而三位数读法为 n hundred and 两位数读法 | |
| """ |
| # _*_coding:utf-8_*_ | |
| # !/usr/bin/env python | |
| # 给出一个整型数字,返回代表该值的英文 | |
| # 范围为[0, 1000) | |
| # 思路: | |
| # 是否是不规则读法; | |
| # 两位数读法; | |
| # 三位数 = n hundred and 两位数读法 |
| # _*_coding:utf-8_*_ | |
| #!/usr/bin/env python | |
| # define a function which can compute the squareroot of the number | |
| def squarerootbi(number, epsilon): | |
| """ | |
| 利用二分法计算给定数字和精度的近似平方根 | |
| :rtype: float | |
| :param number:给定的数字 |
| # _*_coding:utf-8_*_ | |
| #!/usr/bin/env python | |
| # define a function which can compute the squareroot of the number | |
| def squarerootbi(number, epsilon): | |
| """ | |
| 利用二分法计算给定数字和精度的近似平方根 | |
| :rtype: float | |
| :param number:给定的数字 |