随笔分类 - 算法
摘要:void quickSort(int(&arr)[BUFSIZ],int start,int end){ int key=arr[start]; int p1=start; int p2=end; if(end=key && arr[p2]2){ ...
阅读全文
摘要:#include "stdafx.h"#include #include #include #include #include #include #include using namespace std;#define BUFSIZ 100int (&strToIntArr(string s,int...
阅读全文
摘要:CODE#include #include #include #include #include using namespace std;struct Point { double x, y;};double cross(const Point &A, const Point &B, const P...
阅读全文
摘要:分页管理机制(线性地址转换到物理地址)作者:谭杭波.MP480386开始支持存储器分页管理机制。分页机制是存储器管理机制的第3二部分。段管理机制实现虚拟地址(由段和偏移构成的逻辑地址)到线性地址的转换,分页管理机制实现线性地址到物理地址的转换。如果不启用分页管理机制,那么线性地址就是物理地址。本文将...
阅读全文
摘要:#include #include using namespace std;typedef struct node{ int key; node* lchild; node* rchild; node* parent; int color; int flag;} *PNODE,NODE;//Crea...
阅读全文
摘要:#include "stdafx.h"#include #include #include typedef struct treenode{ int key; int priority; int flag; treenode* parent; treenode* lch...
阅读全文
摘要:#include "stdafx.h"#include #include #include typedef struct node{ int headvex; int tailvex; node* headlink; node* taillink;}arcnode,*parc...
阅读全文
摘要:var arry= new Array();var nums= new Array();var snum;function numchain(){snum=0;for(var i=0;i
阅读全文
摘要:1.递归定义的函数在汇编层面很好理解,函数执行过程中对自身的调用实际上是指令的跳转,遇到调用自身的时候指令跳转到函数体的开始位置继续执行,这种跳转不可避免的打断当前函数的执行过程,当跳转部分的指令执行完毕,当前函数的执行过程又被恢复,这一恢复过程就用到了系统的栈,跳转发生之前,函数的相关参数已经保存...
阅读全文
摘要:用链表存放队列,书上是用的伪指针,比较关键的一点是队列头部到达块的上限时,继续压入元素,会导致伪指针指向块的起始位置,链表无需顾忌这个问题#include using namespace std; struct strqueue;typedef struct strqueue *StrQueue;S...
阅读全文
摘要:#include "stdafx.h"#includeusing namespace std;struct arc{int vertex;arc *nextarc;};struct vnode{int vertex,visited;arc *firstarc;};struct G{vnode adj...
阅读全文
摘要:#include #include using namespace std;//创建大顶堆void build_heap(int a[],int len){ int i=len; bool f=false; while((i*2)>len) { int j=i; while(j!=1) { ...
阅读全文
摘要://算法核心思想并不难理解,即取一个值作为参考值,大于等于参考值的放在一边,小于参考值的放在另一边//程序实现的核心是对两个指针的操作,针对每一个无序的块使用两个指针,一个从左向右滑动,另一个相反,//向右滑动的指针如果碰到一个大于参考值的数,则另一个指针开始向右滑动,直到找到一个小于参考值的数,然...
阅读全文

浙公网安备 33010602011771号