码迷,mamicode.com
首页 >  
搜索关键字:radix sort    ( 13156个结果
OpenJDK 源代码阅读之 Collections
通过阅读 java.util.Collections 学习与操作 Collections 相关算法的实现,例如 sort, search, shuffle. 以及如何实现不可变 collection,如何将普通 collection 包装成线程安全的 collection。...
分类:其他好文   时间:2014-06-11 06:18:18    阅读次数:362
冒泡排序 选择排序 插入排序 java
双向冒泡 1 package com.huang; 2 3 public class _014_bubb_sort { 4 5 int[] b={1,2}; 6 static int a[]={12,4,35,65,43,63,2,6,9,544,43543}; 7 pu...
分类:编程语言   时间:2014-06-10 21:43:40    阅读次数:275
第六章 堆排序 6.5 优先队列
package chap06_Heap_Sort;import static org.junit.Assert.*;import java.util.ArrayList;import java.util.Arrays;import org.junit.Test;/** * 优先队列,二叉堆数组实现,...
分类:其他好文   时间:2014-06-10 16:40:14    阅读次数:347
[LeetCode] Sort Colors [23]
一个数组,数组元素含有3种颜色,红,白,蓝。要求将数组排序,将相同颜色排在一起,整体按照红白蓝的顺序。 这个题在日常生活中很常见。比如要将东西归类,当然这个题简化成了相同颜色就认为完全相同。 基于这个特点,可以先统计各个颜色出现的次数,然后在按照题目要求的红白蓝的顺序,依次放n个红,m个白,k个蓝,就Okay了,代码详见代码一。这个思路也就是题目下面提示的方法,这个方法需遍历2次数组,本题要求遍历一次就搞定的方法,想想这个还是有点难度的。 这个题目其实我们很容易就能联想到快排的划分上来,但是仔细一想,如果按...
分类:其他好文   时间:2014-06-10 15:56:14    阅读次数:223
【Leedcode】Insertion Sort List
Sort a linked list using insertion sort. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *nex...
分类:其他好文   时间:2014-06-10 12:14:19    阅读次数:253
第六章 堆排序
以后尽量能用迭代就别用递归啊,递归只是让自己轻松了,但是却增加了电脑的负担。 package chap06_Heap_Sort;import static org.junit.Assert.*;import java.util.Arrays;import org.junit.Test;public ...
分类:其他好文   时间:2014-06-10 11:57:27    阅读次数:252
手写BST插入查找删除
binary search\sort\find operations status InsertNode(Node* root, data x, Node* father) { if(root==NULL) { if(father==NULL) Tree empty; else { if(xdata) { father->left=new Node//inital l...
分类:其他好文   时间:2014-06-10 08:09:49    阅读次数:234
Sort Colors
题目 Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the...
分类:其他好文   时间:2014-06-10 07:21:21    阅读次数:261
【Leetcode】Sort List
Sort a linked list inO(nlogn) time using constant space complexity.单向链表排序O(nlogn),Mergesort可以实现。 1 /** 2 * Definition for singly-linked list. 3 * st.....
分类:其他好文   时间:2014-06-10 00:44:11    阅读次数:329
[LeetCode] Insertion Sort List
Sort a linked list using insertion sort.对于指针链表类题,分析时一定要用笔先清晰画出来,每个指针对应那些结点。对比:(1)插入排序的顺序表实现,是对temp从参考点temp往前与一个个元素比较,(2)插入排序的链表实现,是对temp从头结点开始往后与一个个元素...
分类:其他好文   时间:2014-06-09 17:27:30    阅读次数:187
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!