北京大學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