算法
YAOQINGGG
在技术中寻找快乐
展开
-
Leetcode – Add Two Numbers (Java)
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a原创 2014-04-19 17:23:24 · 710 阅读 · 0 评论 -
查找算法
1.二分查找package com.spring.test;/** * Created by brady on 15-1-28. */public class Bi { public static int f(int[] a, int l){ int p =0; int left = 0; int right = a.lengt原创 2015-01-30 10:25:30 · 637 阅读 · 0 评论 -
java的排序算法
冒泡排序 public void bubbleSort(int[] a){ for(int i=a.length-1;i>0;--i){ for(int j=0;j<i;j++){ if(a[j]>a[j+1]){ int temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } }原创 2014-05-06 09:13:32 · 556 阅读 · 0 评论 -
一些算法题
下面都是我在网上搜集的算法题,我自己想了解法1.一个严格递增的序列,从中间某个未知的地方切成两段,将前一段放到后面,求最大值?注意划开的位置你不知道!我的解法2.二维数组(N*N),沿对角线方向,从右上角打印到左下角如N=4: { 1 2 3 4 } { 5 6 7 8 } { 9 10 11 12 } {13 14 15 16 } 打印出来后原创 2015-01-30 10:26:03 · 713 阅读 · 0 评论 -
java算法的基本思想之迭代,递归,动态规划
这里有n个台阶,每次能爬1或2节,请问有多少种爬法?原创 2014-05-06 22:49:54 · 1495 阅读 · 0 评论