北京大学ACM比赛题目 Consider an infinite full binary search tree (see the figure below), the numbers in the Nodes are 1, 2, 3, .... In a subtree whose root Node is X, we can get the minimum number in this subtree by repeating going down the left Node until the last level, and we can also find the maximum number by going down the right Node. Now you are given some queries as "What are the minimum and maximum numbers in the subtree whose root Node is X?" Please try to find answers for there queries.
标签: the Consider infinite numbers
上传时间: 2013-12-16
上传用户:日光微澜
贪吃蛇*要点分析: *1)数据结构:matrix[][]用来存储地图上面的信息,如果什么也没有设置为false, * 如果有食物或蛇,设置为true;NodeArray,一个LinkedList,用来保存蛇的每 * 一节;food用来保存食物的位置;而Node类是保存每个位置的信息。 *2)重要函数: * changeDirection(int newDirection) ,用来改变蛇前进的方向,而且只是 * 保存头部的前进方向,因为其他的前进方向已经用位置来指明了。 其中newDirection * 必须和原来的direction不是相反方向,所以相反方向的值用了同样的奇偶性。在测试 * 的时候使用了direction%2!=newDirection%2 进行判断。 * moveOn(),用来更新蛇的位置,对于当前方向,把头部位置进行相应改变。如果越界, * 结束;否则,检测是否遇到食物(加头部)或身体(结束);如果什么都没有,加上头部, * 去掉尾部。由于用了LinkedList数据结构,省去了相当多的麻烦。
上传时间: 2014-06-14
上传用户:cjf0304
看n2实例 #Create a simulator object set ns [new Simulator] #Define different colors for data flows #$ns color 1 Blue #$ns color 2 Red #Open the nam trace file set nf [open out-1.nam w] $ns namtrace-all $nf set f0 [open out0.tr w] set f1 [open out1.tr w] #Define a finish procedure proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf #Execute nam on the trace file exit 0 } #Create four Nodes set n0 [$ns Node] set n1 [$ns Node] set n2 [$ns Node] set n3 [$ns Node] #Create links between the Nodes $ns duplex-link $n0 $n2 1Mb 10ms
标签: simulator Simulator different Create
上传时间: 2016-07-02
上传用户:wfl_yy
我所采用的内存管理思想是链表管理思想,内存分配方案是最佳适应方案(best fit)。其主要的数据结构为 struct Node { char* p int memosize int flag struct Node* next } 这是一个链表的结点的数据结构,用它来管理内存的分配与回收。P 表示所指的分配的内存的首地址,memosize 表示分配的内存块的大小,flag 为一个标志量,表示内存块是否被占用。用 1 和 0 来表示被占用和不被占用。next 表示下一个结点的首地址。 内存管理包括一个分配内存的mm_request(unsigned int)函数,一个初始化所要管理的内存的mm_init()函数,一个空闲列表排序函数sort(),一个释放内存的mm_release(void* )函数和一个判断内存是否被占用的IsFree(int)函数。
标签: 内存管理
上传时间: 2016-07-06
上传用户:qunquan
操作系统课程设计_进程调度演示源程序 #include "stdio.h" #include "stdlib.h" #include "string.h" typedef struct Node { char name[10] /*进程标识符*/ int prio /*进程优先数*/ int round /*进程时间轮转时间片*/ int cputime /*进程占用CPU时间*/ int needtime /*进程到完成还要的时间*/ int count /*计数器*/ char state /*进程的状态*/ struct Node *next /*链指针*/ }PCB
标签: include typedef stdlib string
上传时间: 2016-08-09
上传用户:凤临西北
abaqus 爆炸模拟 *Heading ** Job name: cbs Model name: Model-1 *Preprint, echo=NO, model=NO, history=NO, contact=NO ** ** PARTS ** *Part, name=Part-1 *Node
标签: Model name Preprint Heading
上传时间: 2016-10-15
上传用户:wangdean1101
*Heading ** Job name: cbs Model name: Model-1 *Preprint, echo=NO, model=NO, history=NO, contact=NO ** ** PARTS ** *Part, name=Part-1 *Node
上传时间: 2016-10-15
上传用户:jqy_china
js 异步加载 tree 采用ajax技术,在点击tree的Node以后从数据库中读取其下面的分支并进行显示,适合于tree数据量较大的情况下异步从数据库中查询并显示于tr
上传时间: 2013-12-29
上传用户:gtf1207
//顺序表的建立、查找、插入与删除 #include <stdio.h> #include <malloc.h> #include <stdlib.h> #define ListSize 100 //表最大长度 //结构定义 typedef struct SeqList { int Node[ListSize] //存放表结点 int length //当前表长度 } SeqList //插入元素 insertList(SeqList *list, int e) { int i=list->length-1 //先将i指定为最后一项 if(i>=ListSize-1) //表已经达到最大长度ListSize { printf("表已满,不能增加新的项!\n")
上传时间: 2014-01-17
上传用户:dongqiangqiang
CAN1.c and CAN2.c are a simple example of configuring a CAN network to transmit and receive data on a CAN network, and how to move information to and from CAN RAM message objects. Each C8051F040-TB CAN Node is configured to send a message when it s P3.7 button is depressed/released, with a 0x11 to indicate the button is pushed, and 0x00 when released. Each Node also has a message object configured to receive messages. The C8051 tests the received data and will turn on/off the target board s LED. When one target is loaded with CAN2.c and the other is loaded with CAN1.c, one target board s push-button will control the other target board s LED, establishing a simple control link via the CAN bus and can be observed directly on the target boards.
标签: CAN configuring and transmit
上传时间: 2013-12-11
上传用户:weiwolkt