北京大學(xué)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.
標(biāo)簽: the Consider infinite numbers
上傳時間: 2013-12-16
上傳用戶:日光微瀾
貪吃蛇*要點(diǎn)分析: *1)數(shù)據(jù)結(jié)構(gòu):matrix[][]用來存儲地圖上面的信息,如果什么也沒有設(shè)置為false, * 如果有食物或蛇,設(shè)置為true;NodeArray,一個LinkedList,用來保存蛇的每 * 一節(jié);food用來保存食物的位置;而Node類是保存每個位置的信息。 *2)重要函數(shù): * changeDirection(int newDirection) ,用來改變蛇前進(jìn)的方向,而且只是 * 保存頭部的前進(jìn)方向,因為其他的前進(jìn)方向已經(jīng)用位置來指明了。 其中newDirection * 必須和原來的direction不是相反方向,所以相反方向的值用了同樣的奇偶性。在測試 * 的時候使用了direction%2!=newDirection%2 進(jìn)行判斷。 * moveOn(),用來更新蛇的位置,對于當(dāng)前方向,把頭部位置進(jìn)行相應(yīng)改變。如果越界, * 結(jié)束;否則,檢測是否遇到食物(加頭部)或身體(結(jié)束);如果什么都沒有,加上頭部, * 去掉尾部。由于用了LinkedList數(shù)據(jù)結(jié)構(gòu),省去了相當(dāng)多的麻煩。
標(biāo)簽: matrix 貪吃蛇 分 數(shù)據(jù)結(jié)構(gòu)
上傳時間: 2014-06-14
上傳用戶:cjf0304
看n2實(shí)例 #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
標(biāo)簽: simulator Simulator different Create
上傳時間: 2016-07-02
上傳用戶:wfl_yy
我所采用的內(nèi)存管理思想是鏈表管理思想,內(nèi)存分配方案是最佳適應(yīng)方案(best fit)。其主要的數(shù)據(jù)結(jié)構(gòu)為 struct Node { char* p int memosize int flag struct Node* next } 這是一個鏈表的結(jié)點(diǎn)的數(shù)據(jù)結(jié)構(gòu),用它來管理內(nèi)存的分配與回收。P 表示所指的分配的內(nèi)存的首地址,memosize 表示分配的內(nèi)存塊的大小,flag 為一個標(biāo)志量,表示內(nèi)存塊是否被占用。用 1 和 0 來表示被占用和不被占用。next 表示下一個結(jié)點(diǎn)的首地址。 內(nèi)存管理包括一個分配內(nèi)存的mm_request(unsigned int)函數(shù),一個初始化所要管理的內(nèi)存的mm_init()函數(shù),一個空閑列表排序函數(shù)sort(),一個釋放內(nèi)存的mm_release(void* )函數(shù)和一個判斷內(nèi)存是否被占用的IsFree(int)函數(shù)。
標(biāo)簽: 內(nèi)存管理
上傳時間: 2016-07-06
上傳用戶:qunquan
操作系統(tǒng)課程設(shè)計_進(jìn)程調(diào)度演示源程序 #include "stdio.h" #include "stdlib.h" #include "string.h" typedef struct Node { char name[10] /*進(jìn)程標(biāo)識符*/ int prio /*進(jìn)程優(yōu)先數(shù)*/ int round /*進(jìn)程時間輪轉(zhuǎn)時間片*/ int cputime /*進(jìn)程占用CPU時間*/ int needtime /*進(jìn)程到完成還要的時間*/ int count /*計數(shù)器*/ char state /*進(jìn)程的狀態(tài)*/ struct Node *next /*鏈指針*/ }PCB
標(biāo)簽: 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
標(biāo)簽: 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
標(biāo)簽: Model name NO Preprint
上傳時間: 2016-10-15
上傳用戶:jqy_china
js 異步加載 tree 采用ajax技術(shù),在點(diǎn)擊tree的Node以后從數(shù)據(jù)庫中讀取其下面的分支并進(jìn)行顯示,適合于tree數(shù)據(jù)量較大的情況下異步從數(shù)據(jù)庫中查詢并顯示于tr
上傳時間: 2013-12-29
上傳用戶:gtf1207
//順序表的建立、查找、插入與刪除 #include <stdio.h> #include <malloc.h> #include <stdlib.h> #define ListSize 100 //表最大長度 //結(jié)構(gòu)定義 typedef struct SeqList { int Node[ListSize] //存放表結(jié)點(diǎn) int length //當(dāng)前表長度 } SeqList //插入元素 insertList(SeqList *list, int e) { int i=list->length-1 //先將i指定為最后一項 if(i>=ListSize-1) //表已經(jīng)達(dá)到最大長度ListSize { printf("表已滿,不能增加新的項!\n")
標(biāo)簽: include gt lt malloc
上傳時間: 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.
標(biāo)簽: CAN configuring and transmit
上傳時間: 2013-12-11
上傳用戶:weiwolkt
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1