- 博客(162)
- 问答 (1)
- 收藏
- 关注
原创 red-black tree
#include<bits/stdc++.h>using namespace std;#define BLACK 1#define RED 0struct node{ int value; int color; node * left; node * right; node * parent;};node * grandparent(node *n)
2016-09-21 20:59:53 416
原创 ready for preview
init进程没有父进程信号量(表示可用资源数)变化范围 1~ -(m-1)大多数rtos(real time operation system实时操作系统)调度算法都是可抢占式虚拟存储器的实际容量=min(计算机地址,内存+辅存)全局变量只能在一个进程中的多个线程中实现共享进程是pcb结构与程序和数据的结合现代操作系统的基本特征:并发,共享,虚拟技术,异步.*
2016-09-07 16:31:52 308
原创 heap
#include<bits/stdc++.h>using namespace std;template<typename T> class Heap{ private: T a[100]; int index; public: void heapipy(); void push(T e); T top(
2016-08-29 22:51:34 458
原创 hdu3068 Manacher --> find the longest palindrome
#include<bits/stdc++.h>using namespace std;char ss[250020];char s[250020];int p[250000];int main(){ while(scanf("%s",s)!=EOF){ memset(p,0,sizeof(p)); int i,j; int len =
2016-08-12 22:12:07 238
原创 AVL
reference: 数据结构 邓俊辉 第三版#include<iostream>using std::swap;using std::cout;using std::cin;using std::endl;using std::max;#define pnode node*#define isRoot(x) (!((x).parent))#define isLChild(x) (!
2016-08-11 16:25:23 337
原创 Binary Search Tree (BST)
BST is a effective data structure for inserting,removing,searching. All of them cost log(n) #include<bits/stdc++.h>using namespace std;typedef struct node{ int value; node* lc; node* rc;}
2016-08-05 18:05:16 219
原创 adjacency_matrix & adjacency_list
/* * 3--------4--------5 * | | | * | | | * | | | * 1--------2--------6 * \ / *
2016-08-03 20:48:23 864
原创 Hash Table
A simple hash table code, to be continuedimport randomHT = [None for x in range(15)]res = random.randrange(100)key = 13l = len(HT)## count(elements)<key<l#def insert(n): ans = n%key
2016-08-01 15:46:59 253
原创 Linked List->single linked list
#include<bits/stdc++.h>using namespace std;typedef struct List{ int value; List* next;}*Link;Link head = NULL;Link tail = NULL;void InsertHead(int value){ Link tmp = new List; tmp->
2016-08-01 01:00:20 308
原创 Radix Sort
Radix sort is effective when the size of elements are short. and it’s steady.#include<bits/stdc++.h>using namespace std;int L[] = {3321,1,10,9680,577,9420,7,5622,4793,2030,3138,82,2599,743,4127};int
2016-07-31 16:46:48 342
原创 Counting Sort
As for counting sort,we need to know the range of value of the array.It can not be too large. Than we count how many times the element comes. At last, we start from 0 to max value as i, if count[i] is
2016-07-28 00:49:14 251
原创 Quick sort
#include<bits/stdc++.h>using namespace std;int L[] = {3,44,38,5,47,15,36,26,27,2,46,4,19,50,48};void QuickSort(int left,int right){ int l = left; int r = right; if(left>=right){ re
2016-07-27 15:45:47 491
原创 insertion sort
For each time, extract the next unsorted element from 1,2,…n,if current sorted element bigger than unsorted element, move sorted element to the right by 1, or insert the extracted element/* insertio
2016-07-25 22:55:21 174
原创 Sort Algorithm-->Select Sort
Each traversal find the minimal element start from 1 to n,than compare with the index of i,i+1…n-1,if smaller than swap them or next traversal"""select sortlanguate:python3.5author:zhoutonglx"""#orig
2016-07-24 23:38:50 201
原创 Sort Algorithm-->Bubble Sort
Bubble sort:Everytime index start from left,compare two elements,if left element bigger then right element,than swap them, or index move to next. After a traverse, the max element of the rest will floa
2016-07-24 20:16:45 279
原创 win gvim
set number set guifont=courier_new:h14 set backspace=eol,indent,start set history=10000 set autoindent set smartindent set tabstop=4 set shiftwidth=4 set expan
2016-03-28 14:52:11 254
原创 mysql
as不是给表里的字段取别名,而是给查询的结果字段取别名。其目的是让查询的结果展现更符合人们观看习惯,在多张表查询的时候可以直接的区别多张表的同名的字段。
2016-02-29 02:57:27 242
原创 ubuntu 14.04 nginx php
打开/etc/nginx/sites-available中的default文件进行修改#添加一个index.phpserver { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.
2016-02-22 10:19:19 418
原创 php 总结
function_exists(‘func_name’); 判断自定义的函数是否存在class_exists(‘class_name’); 判断自定义的类是否存在当调用类的属性时,用 $this->attribute 注意,attribute前没$,而this前有声明函数时要前要写 function
2016-02-15 06:22:55 347
原创 html基础
外部css 用link标签 <link rel='stylesheet' type='text/css' href='__PUBLIC/test.css />外部js <script src='__PUBLIC__/test.js>
2016-02-12 19:36:31 207
原创 python 基础3
可以这样理解map() map(f,iterable) [f(x) for x in iterable]map()函数会根据提供的函数对指定的序列做映射map(function,sequence[,sequence,…])—>listfilter(function or None,sequence)–>list,tuple,string,为true返回,false过滤*
2016-02-08 20:46:48 287
原创 python 基础
cmp(str1,str2) 比较字符串,str1>str2值是1,相等是0,小于是-1元组和字符串的值不能进行修改定义单一元素的元组时,必须加逗号,如 t1=(3,),否则该例子就是整形如果有元组t=(“hehe”,30,”,”male”),可以将元组赋值给变量,name,age,sex'=t,一般定义变量也可以这样a,b,c=1,2,3;提倡给1,2,3加上括号列表添加元素list.ap
2016-02-04 21:10:17 534
原创 thinkphp CURD
对数据的读取$m=M(‘User’);$m->select(); //获取所有数据,以数组形式返回$m->find(); //只返回一条数据,默认id为1,也以数组形式返回,如* 果要返回id为2,则用$m->find(2);$m->delete()会删除所有数据,要删除具体数据,可以$m->where(‘id=2’)->delete()或$m->delete(2),返回值是删除
2016-02-04 14:08:48 377
原创 python 基础2
hex(),只能将整数转换成十六进制的字符串bool(),bool(0),bool(”),bool(False)是转换成False,其他都是True在当前目录导入一个py的函数,from 文件名(不加py) import 函数名(不加括号)*
2016-02-04 10:38:04 263
原创 yii2 命名空间
A.phpnamespace a\b\c;class Apple(){ public function get_info(){ echo 'this is a'; }}B.phpnamespace d\e\f;class Apple(){ public function get_info(){ 'echo this is b';
2016-01-28 22:17:20 1603
原创 php 进阶
创建画布:$img = imagecreatetruecolor(100,1000);确定画布颜色:$red = imagecolorallocate($img,0xff,0x00,0x00);线条绘制:imageline($img,0,0,100,100,\$red);输出图像:header(“content-type: image/png”); imagepng($img);释放图片占用
2016-01-28 20:25:46 390
原创 php 文件
resource fopen(string filename,string mode [ , int use_include_path [ , resource context]]) 打开指定文件,文件名可以是: ./php.ini 或者一个url: ftp://www.csdn.net
2016-01-23 20:37:07 245
原创 php时间观念
在php.ini中修改时区,定位到 ;date.timezone= 去除分号,设置值为Asia/Shanghai或PRC等 * date_default_timezone_set(timezone) timezone为可识别的时区名称,如PRC,Asia/Chongqing,否则系统采用UTC时区 注:如果服务器使用的是0时区,则不能直接对php.ini进行修改,只能通过该函数设置
2016-01-19 16:55:25 331
原创 php 字符串
mixed str_ireplace(mixed search,mixed replacce,mixed subject [,int &count])
2016-01-19 16:22:28 297
原创 php mysql
mysql_fetch_assoc($result)从结果集中取出一行记录,再次调用会指向下一条记录数据库连接:$link = mysqli_connect('host','user','password');查询类语句返回一个资源句柄,可以获取改资源,如下: $res = mysql_query('select * frome user limit 1'); $row = mysql_fe
2016-01-16 15:00:41 285
空空如也
gvim imap 会注释所有文字怎么办
2015-02-12
TA创建的收藏夹 TA关注的收藏夹
TA关注的人