
算法
文章平均质量分 75
yyj341
Practice is the sole criterion for testing truth!
展开
-
网易有道笔试编程之队列构造
题目:小明同学把1到n这n个数字按照一定的顺序放入了一个队列Q中。现在他对队列Q执行了如下程序:while(!Q.empty()){ int x=Q.front(); //取出当前队头的值x Q.pop(); //弹出当前队头 Q.push(x); //取出这时候队头的值 print("%d\n",x); /原创 2016-08-18 17:21:44 · 1215 阅读 · 0 评论 -
快排之Java实现
public class QuickSorting { public static void main(String[] args) { int iArray[]={12,1,3,2,32,21,41,12,0}; int len=iArray.length; sort(iArray,0,len-1); for(int a:iArray){ System.out原创 2016-08-26 16:57:57 · 446 阅读 · 0 评论 -
冒泡排序、直接插入排序及选择排序之Java实现
1,排序算法之冒泡排序public class BubbleSorting { public static void main(String[] args) { // TODO Auto-generated method stub int iArray[]={12,1,3,2,32,21,41,12,0}; //upBubble(iArray,iArray.length);原创 2016-08-26 17:01:17 · 519 阅读 · 0 评论 -
二叉排序树之Java实现
二叉排序树查找import java.util.Arrays;class BinaryTree{ private class Node{ @SuppressWarnings("rawtypes") private Comparable data; private Node left; private Node right; public Node(@SuppressW原创 2016-08-26 17:07:48 · 464 阅读 · 0 评论 -
堆排序之java实现
排序算法之堆排public class HeapSorting{ public static int LeftChild(int i){ return 2*i+1; } static void PercDown(int A[],int i,int N){ int Child; int Tmp; for(Tmp=A[i];LeftChild(i)<N;i=Child){原创 2016-08-26 17:45:41 · 451 阅读 · 0 评论