- 博客(7)
- 收藏
- 关注
原创 SQL 查找每年评分最低或最低的项目 并排序
SELECT *FROM table AS tWHERE rating IN (SELECT MAX(rating)FROM tableWHERE t.year = year) OR rating IN (SELECT MIN(rating)FROM tableWHERE t.year = year)ORDER BY year ASC, title ASC;
2013-02-08 13:44:19
581
转载 PostgresDB 开始
最近开始学习PostgresDB 很多地方跟MySQL不一样 简单的命令如下(随时更新)psql里查看所有库:\l查看所有表: \dt查看某个表的结构: \d 表名\c testDB 相当于mysql的use database testDB;
2013-02-05 23:33:49
548
转载 Ruby字符串处理函数总结(转自51CTO)
Ruby字符串处理函数1.返回字符串的长度str.length => integer Ruby字符串处理函数2.判断字符串中是否包含另一个串str.include? other_str => true or false "hello".include? "lo" #=> true "hello".include? "ol" #=> false
2013-01-17 23:04:03
414
原创 洗牌算法
洗牌算法,实现完全随机public int[] shuffleDesk(int[] desk) {for(int i = 0; i length; i++) {int tmp = desk[i];int rand = (int) (Math.random() * (desk.length - i) + i); //随机出当前牌后的任意一张牌desk[
2013-01-07 01:40:25
284
原创 给定一个rand5的随机数,生成rand7的随机数
直接上代码public int rand7() {int n;while(true) {int tmp1 = rand5();int tmp2 = rand5();n = (tmp1 - 1) * 5 + tmp2; //n最大值为25if(n return 1 + n % 7;}}}此
2013-01-06 23:50:32
655
转载 三个小方法:交换字符(无buffer)、统计阶乘结尾0的个数、统计整数数组中连续数字的最大和
1. 交换字符(无buffer)public void swapNumWithoutBuffer(int a, int b) {a = b - a;b = b - a;a = a + b;System.out.println(a +" " + b);}2. 统计阶乘结尾0的个数public int getTaili
2013-01-06 12:07:05
376
原创 Begin (Binary Search)
开通博客记录自己的学习过程是每个程序员都应该做的事情。之前因为太懒,一直没开始这个must do的事情。。。今天开始第一篇博文,本人算法实在不行,之前根本没学过,就从最简单的二分查找开始吧。public class BinarySearch {public static void main(String[] args) {int[] array = {1, 2, 3,
2013-01-06 11:59:10
232
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅