随笔分类 -  数据结构和算法

摘要:这也是豆瓣2016年的一道笔试题。。。 参考:http://www.3lian.com/edu/2015/06-25/224322.html LRU(least recently used)就不做过多的解释了(否则你也不会找到这篇文章了)。 python实现的两种方法: 1、通过collection 阅读全文
posted @ 2016-05-04 17:24 Esapinit 阅读(6182) 评论(1) 推荐(0)
摘要:#include #include using namespace std; typedef struct node { int element; struct node *next; struct node(int data):element(data),next(NULL){}; }Node; Node* reverse_t(Node *head) { Node *cur ... 阅读全文
posted @ 2016-04-14 16:23 Esapinit 阅读(232) 评论(0) 推荐(0)
摘要:#include #include using namespace std; void swap(vector &arr, int a, int b) { int temp = arr[a]; arr[a] = arr[b]; arr[b] = temp; } void ajust_heap(vector&arr, int hole, int len) { ... 阅读全文
posted @ 2016-03-31 11:03 Esapinit 阅读(303) 评论(0) 推荐(0)
摘要:参考:http://www.cnblogs.com/dolphin0520/archive/2011/08/25/2153720.html 阅读全文
posted @ 2016-03-24 20:18 Esapinit 阅读(249) 评论(0) 推荐(0)
摘要:#!coding:utf8 def quicksort(list_num, left, right): if left > right: return low = left high = right privot= list_num[left] while low<high: while low < 阅读全文
posted @ 2016-02-21 16:26 Esapinit 阅读(327) 评论(0) 推荐(0)
摘要:记:最近在使用python进行学生成绩管理系统设计时,遇到了一个中文显示的问题,这个问题困扰了一个上午,查阅了有关资料,锁定了原因——编码问题。最终更改编码设置,问题得到了解决。具体做法: 1 Python文件设置编码 utf-8 (文件前面加上 #encoding=utf-8) 2 MySQL... 阅读全文
posted @ 2015-04-28 12:34 Esapinit 阅读(437) 评论(0) 推荐(0)