- 博客(20)
- 收藏
- 关注
原创 堆的基本操作
package datastructure;class Heap{ int[] data; int length; }class HeapOp{ public Heap create(Heap heap){ int n = heap.length; for(int i = (n - 1) / 2; i >= 1; i--)
2015-06-19 16:32:30 417
原创 哈夫曼编码与解码
package datastructure;import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.PriorityQueue; import java.util.Queue;class HuffmanTree { char data; HuffmanT
2015-06-19 11:10:39 657
原创 二叉排序树的基本操作
package datastructure;class BSTree{ int data; BSTree leftchild; BSTree rightchild; }class BST{ //搜索 public BSTree search(BSTree tree, int key){ if(tree == null)
2015-06-18 15:31:37 396
原创 双向冒泡排序
package sort;public class CocktailSort1 { public static void Swap(int array[],int i,int j){ int temp = array[i]; array[i] = array[j]; array[j] = temp; } public static
2015-06-17 17:29:56 291
原创 希尔排序
package sort;public class ShellSort1 { public static void ShellSort(int array[]){ int gap,i,j; for(gap = array.length / 2;gap > 0;gap /= 2){ for(i = gap;i < array.length;
2015-06-17 17:28:39 279
原创 图的基本操作
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.Stack;//邻接矩阵 class Graph{
2015-06-17 16:32:58 359
原创 用栈实现表达式求值
#include using namespace std; typedef double ElemType; #define maxsize 100 typedef struct SN { ElemType data[maxsize]; int top; } StackNode; StackNode StackInit() { StackNode s;
2015-06-16 23:09:13 1719 1
原创 哈夫曼编码
#include <iostream> #include <string> #define n 4 #define m 2*n-1 using namespace std; const int MAX = 100;typedef struct { int weight; int parent, lchild, rchild; } HuffmanTree;typedef Huffman
2015-06-16 23:07:52 340
原创 拓扑排序
#include <iostream> using namespace std; #define MAXVERTEX 100 #define NULL 0 struct ArcNode { int adjvex; ArcNode *nextarc; };struct VerNode { int vertex; ArcNode *fistarc; };struct Al
2015-06-16 23:06:41 289
原创 学习编程好网站
结构之法 ACM之家 POJ训练纪实 我爱算法 经典算法大全 ACM大赛必备_常用函数整理_ACM模板微软、Google等面试题 收集一些top软件公司经典算法面试题经典算法面试题及答案ACM常用数据结构_ACM题集以及各种总结大全 POJ解题总结Ed Karrels的博客 董的博客 梦醒潇湘love cnBlog算法速成系列 671coder的专栏 MoreWindows Blog- 微软最
2015-06-16 22:58:55 566
原创 求图的关键路径
#include <iostream> using namespace std; #define MAXVERTEX 100 typedef int infotype; #define NULL 0 struct ArcNode { int adjvex; infotype *info; ArcNode *nextarc; };struct VerNode { int
2015-06-16 22:56:07 870
原创 求图中任意两个顶点间的最短路径
#include <iostream> using namespace std; const int MAXVERTEXNUM = 100; const int MAX_WEIGHT = 32767; struct MGraph { char vers[MAXVERTEXNUM]; int edges[MAXVERTEXNUM][MAXVERTEXNUM]; int n,
2015-06-16 22:54:53 3498
原创 并查集求最近公共祖先
package algorithm;import java.io.BufferedOutputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Ha
2015-06-16 15:06:11 495
原创 选择排序
package sort;public class SelectionSort1 { public static void SelectionSort(int array[]){ for(int i = 0;i < array.length - 1;i++){ int min = i; for(int j = i + 1;j <
2015-06-16 15:04:09 298
原创 冒泡排序
package sort;public class BubbleSort1 { public static void BubbleSort(int array[]){ for(int i = array.length-1;i > 0;i--){ for(int j = 0;j < i;j++){ if(array[j] >
2015-06-16 15:03:31 273
原创 kmp bm sunday 字符串查找算法
package algorithm;class Kmp{ public int index(String a, String b){ if(a == null || b == null || a.length() < b.length()) return -1; int temp ; for(int i = 0, j =
2015-06-16 15:01:27 585
原创 快速排序
package sort; public class QuickSort1 { public static void QuickSort(int array[],int low,int high){ if(low >= high) return; int i = low; int j = high; int
2015-06-16 14:57:58 286
原创 堆排序
package sort;public class HeapSort1 { public static void Heapify(int array[],int length){ for(int i=length/2 ; i >= 0; i-- ){ SiftDown(array,i,length); } } publ
2015-06-16 14:55:26 287
原创 树的基本操作
package datastructure;import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.Stack;class BiTree{ char data; BiTree leftchild;
2015-06-16 14:53:27 350
原创 图的最短路径
#include <iostream> using namespace std; const int MAXVERTEXNUM = 100; const int MAX_WEIGHT = 32767; struct MGraph { char vers[MAXVERTEXNUM]; int edges[MAXVERTEXNUM][MAXVERTEXNUM]; int n,
2015-06-16 14:50:28 409
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人