- 博客(4)
- 收藏
- 关注
原创 Leetcode 283 MoveZeros
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling you
2016-09-08 12:15:33
267
1
原创 Queue(啊哈算法)
下面摘录啊哈算法中的重点片段及queue实现代码,同时总结数据结构队列的常见用法队列概念*队列是一种特殊的线性结构,它只允许在队列的首部(head)进行删除操作,这称为“出队”,而在队列 的尾部(tail)进行插入操作,这称为“入队”。当队列中没有元素时(即head==tail),称为 空队列。*队列符合先进先出的原则(FIFO)*队列是广度优先搜索以及队列优化的Bellman-Ford 最短路
2016-08-13 18:11:50
316
原创 单链表实现
//IntList and Linked Data Structures //IntList /* Defines a recursive list of integers.*/public class IntList{ public int head; public IntList tail; public IntList(int h, IntList t){
2016-08-06 12:00:41
306
原创 Sort(啊哈算法)
桶排序/** 给定5个同学的分数,按照从大到小的顺序排序 桶排序 时间复杂度:O(M+N) 缺点:浪费空间 */ int main(){/****************5***************/ int a[11]; for(int i=0; i<=10; i++){ a[i] = 0; //初始化为0 }for(int i=0; i<5; i++){ //循环读入5个数
2016-08-06 11:45:12
255
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人