![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法导论
DataChat.Club
这个作者很懒,什么都没留下…
展开
-
算法导论学习2.1-4 二进制加法
public class Binary_Plus { public static void main(String[] args) { int[] a = {0,1,0}; int[] b = {0,1,0}; int[] c = new int[a.length + 1]; plus(a,b,c); for(int i = 0; i < c.length; i ++)原创 2012-03-27 15:30:10 · 1497 阅读 · 0 评论 -
算法导论学习2.1 插入排序
public class InsertionSort { public static void main(String[] args) { int[] a = {5,2,4,6,1,3,0}; sort(a); for(int i = 0; i < a.length; i++) { System.out.print(a[i] + " ");原创 2012-03-27 15:14:49 · 416 阅读 · 0 评论 -
算法导论学习2.3 分治法 (这个递归终于懂了。。)
import java.util.Arrays; public class MergeSort { public static void main(String[] args) { int[] data = {2,4,0,7,1,8,3,6}; sort(data, 0, data.length - 1); for(int i原创 2012-03-27 16:00:52 · 678 阅读 · 0 评论 -
算法导论学习2.1-3 查找问题
public class Search { public static void main(String[] args) { int[] a = {1,2,3,4,5,6,7,8,9,0}; int v = 11; System.out.print("v in a[" + search_v(v,a) + "] (a[-1] means " + v + " is not in th原创 2012-03-27 15:22:35 · 810 阅读 · 0 评论 -
算法导论学习2.3-4 插入排序的递归版本
public class InsertionSortRecursion { public static void main(String[] args) { int[] data = {5, 2, 4,6,9,0, 3}; recursion(data, 0, data.length - 1); for (int i = 0; i < data.length; i++) { S原创 2012-03-28 10:05:36 · 1362 阅读 · 0 评论 -
算法导论学习2.3-5 二分查找的递归形式
import java.util.*; public class BinarySearch { public static void main(String[] args) { int[] data = {0,1,2,3}; int key = 1; int[] num = {0}; search(data, 0, data.length - 1, key ,num);原创 2012-03-28 15:44:24 · 581 阅读 · 0 评论 -
算法导论学习10.1 两个栈共享一个数组 and 两个栈实现一个队列 and 两个队列实现一个栈
ArrayStack.h (顺序栈的基本操作) #include #include #define MAXNUM 4 #define OVERFLOW -1 #define UNDERFLOW -2 typedef int elemtype; //顺序栈 typedef struct ArrayStack { elemtype data[MAXNUM]; int top; }A原创 2012-06-25 21:54:58 · 3036 阅读 · 0 评论