- 博客(8)
- 资源 (1)
- 收藏
- 关注
原创 Reverse linked list
1. Iterativepublic void reverse(head){ ListNode current, prev, next; current = head; prev = null; while(current!=null){ next = current.next; current.next = prev;
2014-02-26 06:42:25
326
原创 公式测试
public void reverse(head){ ListNode current, prev, next; current = head; prev = null; while(current!=null){ next = current.next; current.next = prev; prev = cur
2014-02-24 16:22:10
385
原创 各种sorting总结
Selection sort:1. Divide the input into two part: sublist of items already sorted and sublist of items to be sorted.2. Find the smallest element in unsorted sublist, exchange it with the leftmos
2014-02-18 09:09:22
720
原创 Linkedlist实现Queue
public class Queue{ private Node first; private Node last; private class Node{ Item item; Node next; } public boolean isEmpty(){ return first == null; } public void enqueue(Item item){
2014-02-18 08:10:27
438
原创 Linkedlist和Array实现Stack
LinkedList实现Stackpublic Class Stack{ private Node first = null; private class Node{ Item item; Node next; } public boolean isEmpty(){ return first == null; } public void push(Item i
2014-02-18 08:02:04
535
原创 Affinity propagation for clustering
Basic idea: message passing. Number of clusters automatically determined.2 matrices to be updated: responsibility R and availability A.R: to let exemplars compete for ownership of a data
2014-02-14 14:29:07
537
原创 Single Number I and II, 数组里找出没重复的数
public class Solution{public int singleNumber(int[] A){int ret=0;for(int i:A){ret=ret^i;}return ret;}}一个数组中,除了一个元素以外其他每个数组都出现两次,找出这个单独出现一次的数。Given an array of integers, every element appea
2014-02-14 06:21:00
484
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人