数据结构与算法
fay625
这个作者很懒,什么都没留下…
展开
-
排序之冒泡java版
冒泡排序 public static int[] bubbleSort(int []data){ //循环变量 int i,j,k; int temp; //外层扫描的次数 for(j=data.length;j>1;j--){ //内层比较 f原创 2016-03-18 10:05:47 · 243 阅读 · 0 评论 -
排序之归并排序java版
public class MergeSort { //合并 public static int[] merge(int low,int middle,int high,int []array){ int arrLength=array.length; int []tempArr=new int[arrLength]; //要合并的左右两半原创 2016-03-18 11:49:30 · 212 阅读 · 0 评论 -
排序之快速排序java版
比较好理解的方法 public static void quickSort(int[] a, int left, int right){ int index=partition(a,left,right); //排序左半部分 if(left<index-1){ quickSort(a,left,i原创 2016-03-18 10:12:55 · 224 阅读 · 0 评论 -
KMP算法
左老师KMP算法:KMP算法 【题目】 给定两个字符串str和match,⻓度分别为N和M。实现⼀个算法,如果字符串str 中含有字串match,则返回match在str中的开始位置,不含有则返回-1。 【举例】 str=“acbc”, match=“bc”。 返回2。 str=“acbc”, match=“bcc”。返回-1。 【要求】 如果match的⻓度⼤于str⻓度(M>N)翻译 2016-07-17 18:50:08 · 841 阅读 · 0 评论 -
KMP算法
好文章: http://blog.csdn.net/v_july_v/article/details/7041827原创 2016-07-06 19:48:07 · 185 阅读 · 0 评论 -
线段树
线段树?参考博客转载 2016-04-22 14:59:35 · 160 阅读 · 0 评论 -
图之概念篇
参考资料: 数据结构与算法分析C++语言描述 http://www.cnblogs.com/Braveliu/archive/2013/12/03/3455442.html 有向图ADT 数据元素集合: 一个有限的称为顶点(vertices)或结点(nodes)的元素集合以及一个有限的连接每对顶点的有向弧或有向边的集合。 基本操作: -创建一个空的有向图原创 2016-04-04 13:55:18 · 412 阅读 · 0 评论 -
AVL树
参考资料: http://blog.csdn.net/xiaofan086/article/details/8294382 <数据结构与算法分析>-C语言描述 Mark Allens Weiss 承接上个二叉查找树:/* * avl.h * * Created on: 2016年4月3日 * Author: fay */#ifndef AVL_H_ #define AV原创 2016-04-04 13:23:59 · 357 阅读 · 0 评论 -
二叉查找树
参考资料: http://blog.csdn.net/xiaofan086/article/details/8294382 <数据结构与算法分析>-C语言描述 Mark Allens Weiss/* * tree.h * 以下为二叉中查找树的定义 * Created on: 2016年4月2日 * Author: fay */#ifndef SEARCHTREE_H_原创 2016-04-02 17:57:24 · 156 阅读 · 0 评论 -
排序之插入排序java版
public class InsertSort { public static void insertSort(int []arr){ int i=0,j=0; //欲插入数据变量 int insertNode; int index=arr.length; //依次插入数据 for(i=1;i<i原创 2016-03-18 12:14:09 · 300 阅读 · 0 评论 -
排序之堆排序java版
public class HeapSort { public static void percolate_down(int data[],int r,int n){ int c=2*r; while(c<=n){ if(c<n&&data[c]<data[c+1]){ c++; }原创 2016-03-18 11:39:48 · 206 阅读 · 0 评论