
数据结构
文章平均质量分 53
zhoujunr1
这个作者很懒,什么都没留下…
展开
-
NP
deterministicPNPNP-complete problemsreducibility of algorithmNP-completeNP (for nondeterministic polynomial time) is a complexity class used to describe certain types of decision problems.determini原创 2017-08-22 10:55:19 · 307 阅读 · 0 评论 -
二叉排序树 c
/* ds.h *//* Some pre define */#ifndef _HS_H#define _HS_H#include <string.h>#include <ctype.h>#include <sys/malloc.h>#include <stdio.h>#include <stdlib.h>/* State code */#define TRUE 1#define原创 2017-10-03 16:26:43 · 239 阅读 · 0 评论 -
二叉树 c
/* ds.h *//* Some pre define */#ifndef _HS_H#define _HS_H#include <string.h>#include <ctype.h>#include <sys/malloc.h>#include <stdio.h>#include <stdlib.h>/* State code */#define TRUE 1#define原创 2017-10-03 14:15:57 · 203 阅读 · 0 评论 -
链表 c
// linkedLinearList.cs#include <stdio.h>#include "ds.h"typedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}LNode, *LinkList;/* InitLinkList*/Status InitList(LinkList原创 2017-10-02 18:42:16 · 233 阅读 · 0 评论 -
排序算法(一) c语言
// main.c#include <stdio.h>#include "sortD.h"#include "sortD.c"#define N 12int main() { RedType d[N]={{0, ' '}, {3,'l'},{6,'e'},{5,'v'},{2,' '},\ {11, '!'}, {9,'o'},{1,'I'},{7原创 2017-10-01 09:27:02 · 247 阅读 · 0 评论 -
dynamic sets
操作分为两类: queries, modifying operation,前者只是返回信息,后者会改变setsearch(S, k)insert(S, x)delete(S, x)minimum(S)maximum(S)successor(S, x)predecessor(S, x)原创 2017-09-02 11:04:20 · 765 阅读 · 0 评论 -
二叉树 c 实现
/* binaryTreeMain.c */// #define CHAR#include "ds.h"#ifdef CHAR typedef char TElemType; TElemType Nil=' ';#endif#ifdef INT typedef int TElemType; TElemType Nil=0;#endif#include "binaryTree.原创 2017-09-27 14:34:09 · 304 阅读 · 0 评论 -
Medians and Order Statistics
selection problem最小最大Randomized selectSelection in worst-case linear timeith order statistic: 第i小的元素 median: 中位数selection probleminput:n个大小不同的数和一个整数i output:第i小的元素可以先排序,再选择,时间复杂度 O(nlgn)O(n\lg{n原创 2017-09-01 21:39:24 · 679 阅读 · 0 评论 -
C string
#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct{ char *ch; int length;}MyString;int InitMyString(MyString *s){ // s = (MyString*)malloc(sizeof(MyString)); // 不原创 2017-09-09 12:49:00 · 258 阅读 · 0 评论 -
c指针和结构体
指针与结构体转载 2017-09-08 10:00:49 · 252 阅读 · 0 评论 -
函数指针
[toc] 内容来自 深入理解C指针 这本书堆栈程序栈程序栈用于支持函数执行,通常与堆共享一段内存区域,栈通常占用下部,堆用上部。 程序栈存放栈帧 stack frame 也称 活跃记录 活跃帧。栈帧存放函数参数与局部变量,堆管理动态内存。栈帧的组织返回地址局部数据存储参数存储栈指针和基指针:栈指针指向栈顶,基指针指向栈帧内部地址,比如返回地址局部函数指针传递空指针传递指针的指针如果想转载 2017-09-08 10:57:35 · 279 阅读 · 0 评论 -
c指针 c的动态内存管理
Some base to knownull指针操作符指向常量的指针c的动态内存管理内存泄漏丢失地址动态内存分配函数要不要强制类型转换重复释放处理迷途指针具体请参考 深入理解c指针 第二章Some base to know声明时 * 两边的空白无关紧要 指针在声明后如果不初始化,指向的内容不合法,不能使用。 指针类型指示了指针在 + - 的时候的行为* 号是重载的运算符,在声明原创 2017-09-07 21:43:04 · 328 阅读 · 0 评论 -
链表 c++
linearLinkedList.h#include <iostream>#include <string>using namespace std;struct Node{ int data; Node *next; Node(int a){data=a; next=NULL;}};class LinkList{public: LinkList();原创 2017-09-07 13:08:36 · 234 阅读 · 0 评论 -
C++ 结构体初始化 - 转载
http://www.cnblogs.com/Vincent-Bryan/p/6622790.html#include<bits/stdc++.h>using namespace std;struct Node{ int M, V; Node(int a, int b){ M = a; V = b; }};int main(){ No转载 2017-09-06 22:29:07 · 253 阅读 · 0 评论 -
详解c++指针的指针和指针的引用-转载
http://www.cnblogs.com/li-peng/p/4116349.html转载 2017-09-05 23:15:51 · 214 阅读 · 0 评论 -
hash table
hash tableshash functiondivision methodmultiplication methodUniversal hashinghash tables如图所示,使用一个hash function将原来的key映射到hash表中。碰撞发生在不同的key映射到了同一个位置。hash functiondivision methodh(k)=kmodmh(k) = k\mo原创 2017-09-03 12:48:21 · 333 阅读 · 0 评论 -
number theory 基础数论
Divisibility and divisorsPrime and composite numbersCommon divisors and greatest common divisorsRelatively prime integersUnique factorization最大公约数Modular arithmeticThe groups defined by modular原创 2017-09-04 20:09:13 · 2334 阅读 · 0 评论 -
Ch02
1 Data Structures Lists Queues and Stacks2 Set Representation3 Graphs2.1 Data Structures: Lists, Queues and Stackssuppose ;ELEMENT: index into the arrayNAME[ELEMENT]: item storedNEXT[ELEMENT]: inde原创 2017-08-25 11:42:48 · 217 阅读 · 0 评论 -
数据结构 c 习题
/* 从顺序表中删除具有最小值的元素 并返回该值 空位置由最好一个元素填补 若表为空 显示出错信息并退出*/#include <stdio.h>#include <stdlib.h>#define MAXLENGTH 10typedef int ElemType;typedef struct SqList{ ElemType data[MAXLENGTH]; int lengt原创 2017-10-05 13:54:31 · 322 阅读 · 0 评论