算法导论
Albert_muk
data analyser
展开
-
java wait notify notifyAll and 多线程顺序打印ABCD
wait()?notify()?notifyAll()? wait() : It tells the calling thread to give up the lock and go to sleep until some other thread enters the same monitor and calls notify(). The wait() method releases the原创 2017-07-02 03:01:56 · 628 阅读 · 0 评论 -
排序 归并排序+快排
import java.util.Arrays;import org.stringtemplate.v4.compiler.STParser.template_return;public class GuibingSort { public static int[]sort(int[] array,int low,int high){ int mid = (low+high)原创 2017-06-13 16:35:15 · 175 阅读 · 0 评论 -
排序 堆排序
public class HeapSort { static class ArrayUtils { public static void printArray(int[] array) { System.out.print("{"); for (int i = 0; i < array.length; i++) {原创 2017-06-13 12:21:19 · 178 阅读 · 0 评论 -
归并排序 单链表
package com.demo.linkedlist;public class GuibingSortList {static class Node { public Node next; public int val;}public static Node merge(Node a, Node b) { Node dummyHead, c...原创 2017-06-13 12:08:49 · 240 阅读 · 0 评论 -
最长公共子序列
一个给定序列的子序列就是该子序列中去掉零个或者多个元素,以形式化的方式就是X={x1,x2……xn},另一个序列Z={z1,z2….zn}是X的子序列,如果存在X的一个严格递增下标序列,(i1,i2…in)使得对于所有的j=1,2….k有xi=zj,例如Z={BCDB}是X={ABCBDAB}的一个子序列,相应的下标序列为{2,3,5,7}。 给定两个序列X和Y,称序列Z是X和Y的公共子序列,如果原创 2017-07-05 19:14:17 · 198 阅读 · 0 评论 -
单链表的相关操作
1.单链表的反转 在这里实现一种最简单的链表反转的方法,递归反转,在反转当前借点之前先反转后续的节点,这样层层深入直到最后一个子节点。package com.weibo.linkedlist;public class ReverseNode { static class ListNodes { int key; ListNodes next;原创 2017-06-27 23:38:13 · 164 阅读 · 0 评论