![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
破晓奇兵
这个作者很懒,什么都没留下…
展开
-
BinarySearch的java实现
给出了循环和递归两种实现package com.test1;public class BinarySearch { //return index of value to be found,return -1 if not found //assuming that the array to search is sorted //loop implement/* publi...原创 2019-06-12 15:20:00 · 1756 阅读 · 3 评论 -
归并排序的java实现
package com.test1;public class MergeSort { public static void main(String[] args) { // TODO Auto-generated method stub int[] a={1,3,4,9,6,2,5}; System.out.print("排序前:"); printArray(a); i...原创 2019-06-12 15:28:11 · 92 阅读 · 0 评论 -
树的Breadth-First-Search和Depth-First-Search的java实现
假设待搜索的多叉树结构如下: 1 / | \ 3 5 7 / | \ | / \ 9 2...原创 2019-06-12 16:05:13 · 281 阅读 · 0 评论 -
两个栈实现一个队列-java
思路:两个栈,stackPop用来出队,stackPush用来入队;入队时直接将元素压入stackPush里就好了;出队时先判断stackPop里是否有元素,1)如果有,直接调用stackPop里的pop函数即可,2)如果stackpPop里没有元素,则将stackPush中元素(最后一个元素除外)依次pop出来并push进stackPop里,最后将stackPush中的留下的一个元素po...原创 2019-06-14 14:34:10 · 127 阅读 · 0 评论