1、?1?C 2?B 3?A 4?D 5?C 6?D 7?D 8?D 9?D 10?B 11?C 12?D 13?C 14?A 15?A 16?D 17?A 18?C 19?C 20?C 21?D 22?B 23?A 24?B 25?D 26?A 27?A 28?C 29?B 30?A 31?C 32?D 33?C 34?B 35?D 36?C 37?B 38?A 39?B 40?D?1?j=n?j?1?n?k=n?k*=2?2k=n?k=log2n?O(n)?O(log2n)?T(n)=T1(n)*T2(n)=O(n)*O(log2n)=O(nlog2n)?2?a.?(?b.?)?(?(?c.?
2、(?a/b+(c*d-e*f)/gaa?/b+(c*d-e*f)/ga/?b+(c*d-e*f)/g/abb?+(c*d-e*f)/g/ab+?/?/+(c*d-e*f)/gab/+?(c*d-e*f)/g+ab/(?c*d-e*f)/g+(ab/cc?*d-e*f)/g+(ab/c*?(?*?d-e*f)/g+(*ab/cdd?A3?j j j j j j j j j?1 1 1 1 1 1 1 1 1 1 1?2 2 2 2 2 2 2 2 2 2 2k k k k k k =n?O(lo o o o o o o og g g g g g g g g g g g2 2 2 2 2 2 2
3、2 2 2 2 2 2n)?n)=T1(n)*T T T T T T T T T T T T T T T2 2 2 2 2 2 2 2 2(n(n(n n(n(n(n(n(n(n()=)O(n)n)n)n)n)n)*O O O O O O O O(log2n)n)n)n)n)n)n)n)=O=O=O=O=O=O=O=O=O=O O=(n(log2n)?(?e*f f f f f f f f f f f f)/)/)/)/)/)/)/)/)/)/)/)/)/g g g g g g gf f f f f f f f f f fa a a a a a a a a a a a a a a a a a
4、a a a a a a a a-e*f)/g+(*ab/cd-?*?*-e*f)/g+(ab/cd*-?(?-?e*f)/g+(-ab/cd*ee?*f)/g+(-ab/cd*e*?-?*?f)/g+(-*ab/cd*eff?)/g+(-*ab/cd*ef)?(?/g+ab/cd*ef*-/?+?/?g+/ab/cd*ef*-gg?+/ab/cd*ef*-g?ab/cd*ef*-g/+?f?+(-*?B?(a/b)+(c*d)-(e*f)/g)?+(/(ab)/(-(*(cd)*(ef)g)?+/ab/-*cd*efg?(ab)/(cd)*(ef)*)-g)/)+?ab/cd*ef*-g/+?
5、3?end1?Aend1?end1?1?end2?Aend2?end2?1?A0?A0?end2?end2?0?end1?A?0?end1?0?end1=end2?M-1?0?M-2?M-1?A0?AM-2?end1?end2?end1?end1=0?end2?end2=M-2+1=M-1?end1=(end2+1)mod M?A?4?edbxac?x?b?a?D?5?F?g?+(+(+(+(+(+(+(+(+(+(+(+-*?B B B B B B B B B B B?)-(e*f)/g)?+(/(ab/-*cd*efg?ababababababab b babababab bababab
6、b/c/c/c/c/c/c/c/c/c/c/c/c/c/c c c c c c c c c c c cd*d*d d d d d d d d d d d d d d d d ef ef ef ef ef ef f ef ef f ef ef f ef ef ef ef f f f ef ef ef e ef ef e ef ef ef ef ef ef ef ef ef*-g/g g g/g g g g g g g g g g+?end1?0?enenenenen n n n nenen n nd2d d d d d d d d d d?0 0 0 0 0 0 0 0 0 0 0 0 0 0
7、0 0 0?ene e e e enenene e ene ene e e enenenenenene d d d d d d d d d d d d d d d d d?0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0?T?C?A?B?D?6?D?110?1100?D?7?0?3?0?3?1?0?1?4?0?4?2?6?0?314265?314625?D?8?D?9?4?B?1?4/2?-1=1?1?2?15?4?4?B?B?D?10?1?2?1+2?4?1?9?A?3?i?i+3?i+6?(i=1,2,3)?4?1?9?
8、1+4?7?C?5?1?9?1+5?8?D?B?11?i?i?2?A?2?3?6?7?9?A?B?2?9?B?D?5?9?D?C?9?C?12?x?CPI?20/x?70%?0.7x?CPI?1.2?24/x?P?M?*CPI=0.7x*24/x=24*0.7=16.8?D?13?8?-128127?A?x+y=103-25=78?A?B?-x+y=-103-25=-128?B?D?-x-y=-103+25=-78?D?C?x-y=103+25=128?127?C?14?(f1)?(f2)?(110011001001)2?(101100001100)2?IEEE754?(f1)?1?10011
9、001?1.001?(f2)?1?01100001?1.1?B?D?(f1)?1.001226?(f2)?1.12-30?(f1)?(f2)?(f1)?(f2)?xy?A?(f1)?(f2)?4?1100?1011,?100?011?(f1)?(f2)?IEEE754?1.xxx?(f1)?(f2)?(f1)(f2)?xlchild=NULL&root-lchild=NULL)/?wplwpl+=deep*root-weight;if(root-lchild!=NULL)/?wpl_PreOrder(root-lchild,deep+1);if(root-rchild!=NULL)/?wpl_
10、PreOrder(root-rchild,deep+1);return wpl;?#define MaxSize 100/?int wpl_LevelOrder(BiTree root)BiTree qMaxSize;/?end1?end2?int end1,end2;/?MaxSize-1?end1=end2=0;/?int wpl=0,deep=0;/?wpl?BiTree lastNode;/lastNode?BiTree newlastNode;/newlastNode?lastNode=root;/lastNode?newlastNode=NULL;/newlastNode?qend
11、2+=root;/?while(end1!=end2)/?BiTree t=qend1+;/?if(t-lchild=NULL&t-lchild=NULL)wpl+=deep*t-weight;/?wplif(t-lchild!=NULL)/?qend2+=t-lchild;newlastNode=t-lchild;/?if(t-rchild!=NULL)/?qend2+=t-rchild;newlastNode=t-rchild;if(t=lastNode)/?lastNodelastNode=newlastNode;deep+=1;/?1return wpl;/?wpl?C?C+?stat
12、ic?wpl?0?wpl?0?static?NULL)?wpwpwpwpwpwpwpw wpwpwpw w wpl l l l l l l/?hild;t-lchild;d;d;d;d;d;d;d d;d;/?NULL)/?d2+=t-r r r r r rchchchchchchchchchch h h hil il il il il il il i il l l l l i i i d;d;d;d;d;d;d;d d;d;d d d d d dewlastNode=t-rrrrrr r rrchchchchchchch h h h h hil il il il il il il i i i
13、l il il l i i d;d;d;d;d;d;d d;f(t t t=la la la la la la la la la a la la la la la l la la la last s s s s s s s s s s s Nodededededededededededede edede ededede e)/?la a a a a a a a a a a a a a a a a ast st st st st st st st st st st st st st st st st st s st stNoNoNoN N N NoN NoNoN NoNoNoNoNoNoN d
14、d ded d d =n n n n n n n n n n newewewewewewewewewewewewew wewew wla l l l l l stNo oN NoNoNoNoNoNoNo oNoNo o o o oded d d d d d d d d d;d d d d d ded d d d d d d d epepepepepepepepe e e ep+=1;1;1;/?1 returnrnrnrnrnrnrnrnrnrn nrn n n nrnrn wpl pl pl pl pl pl pl pl pl pl pl l pl p pl;/?C?static?stati
15、c?int wpl_PreOrder(BiTree root,int deep)int lwpl,rwpl;/?wpllwpl=rwpl=0;if(root-lchild=NULL&root-lchild=NULL)/?wplreturn deep*root-weight;if(root-lchild!=NULL)/?lwpl=wpl_PreOrder(root-lchild,deep+1);if(root-rchild!=NULL)/?rwpl=wpl_PreOrder(root-rchild,deep+1);return lwpl+rwpl;C/C+?int wpl_PreOrder(Bi
16、Tree root,int deep)if(root-lchild=NULL&root-lchild=NULL)/?wplreturn deep*root-weight;return(root-lchild!=NULL?wpl_PreOrder(root-lchild,deep+1):0)+(root-rchild!=NULL?wpl_PreOrder(root-rchild,deep+1):0);?(x?y:z)?lastNode?newlastNode?lastNode?newlastNode?end1=(end2+1)%M?2014?42?(1)?(1?)?(2)?Flag=1?Next
17、IDIPMetricFlag=2NextPrefixMaskMetricRouterIDLN_linkNext?(3?)typedef struct?ld,deep+1)1)1)1)1)1)1)1):0 0 0 0 0 0 0 0)child,deep+1):0 0 0 0 0 0 0 0 0 0 0););););););?lastNoNoNoNoNoNoN NoN NoNo o odededed ded d ded d ded ded?nen n n n n n n n n n n wl lwl lwl l l l lasasasasasasa asa a a a tNtNtNtNtNtN
18、tN N NtN N NtNo o o ode?nenenenenen ne e e ewl l l l l l l l l l l l lasasasasasasasasasasas sas sa a tNtNtNtNtNtNtN N NtNtNt t t odododododod d de e e e e e?)%MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM?202020202020202020202020202 2020202 14?unsigned int ID,IP;LinkNode;/Link?typedef structunsigned int Pref
19、ix,Mask;NetNode;/Net?typedef struct Nodeint Flag;/Flag=1?Link;Flag=2?NetunionLinkNode Lnode;NetNode NnodeLinkORNet;unsigned int Metric;struct Node*next;ArcNode;/?typedef struct HNodeunsigned int RouterID;ArcNode*LN_link;Struct HNode*next;HNODE;/?42?(2?)Flag=110.1.1.510.1.1.92Flag=2?192.1.1.0255.255.
20、255.0110.1.1.110.1.1.210.1.1.510.1.1.6Flag=110.1.1.210.1.1.13Flag=110.1.1.610.1.1.134Flag=2?192.1.6.0255.255.255.01Flag=110.1.1.110.1.1.23Flag=110.1.1.110.1.1.102Flag=2?192.1.5.0255.255.255.01Flag=110.1.1.610.1.1.56Flag=110.1.1.210.1.1.144Flag=2?192.1.7.0255.255.255.01Flag=110.1.1.510.1.1.66?(?)?uni
21、on?Link?Net?IP?LSI?8?)Flag=110.1.1.5 5 5 5 5 5 5 5 5 5 5 5 51 1 1 1 10.1.1.92F F F F F F F F Fl l l l l l l la a ag=2?19 9 9 9 9 9 9 9 92 2 2 2 2 2 2 2.1 1 1 1 1 1 1 1 1 1.1 1 1 1 1 1 1 1.02 2 2 2 2 2 2 2 2 2 2 2 25 5 5 5 5 5 55 5 5 5 5 5 5 5 5 5.2 2 2 2 2 2 2 2 2 2 25 5 5 5 5 5 5 55 5 5 5 5 5 5 5 5
22、 5 5.255.01.1.51 1 1 1 1 1 1 1 1 1 1 1 1 10.1.1 1 1 1 1 1 1 1 1 1 1 1.6 6 6 6 6 6 6 6 6 6Fl l l l l l la a a a a a a a a a a ag g g g g g g g g g g g=11 1 1 1 10.1.1.6 6 6 6 6 6 6 6 6 6 6 610 0.1 1 1 1 1 1 1 1 1.1 1 1 1.13 3 34 4 4 4 4 4 4 4 4 4 4 4 4 4Flag=2ag=110.1 1 1 1 1 1 1 1.1 1 1 1 1 1 1 1 1
23、1 1.1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 10 0 0 0 0 0 0 0.1 1 1 1 1 1 1 1 1 1 1 1 1.1 1 1 1 1 1 1 1 1 1.2 2 2 2 2 2 2 2 2 2 23 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3F F F F F F Fl l l l l l l l lag=110.11F F F F F F F F F F F F F F Fl l l l l l l l l l l la a a a a a a a ag g g g g g g g g g g g g=11 1 1 1 1 1 1 1
24、 1 1 10 0 0 0 0 0 0 0 0 0 0 0 0.1 1.1.610.1 1 1 1 1 1 1.1 1 1 1 1 1 1 1 1 1 1 1 1.56F F F F F F F F Fl l l l l la a a a a a a a ag g g g g g g g g g=1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 1 1 1 1 1 1 1 1 1 1 1 1 1 1.1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
25、 1.51 1 1 1 1 1 1 1 1 1 1 1 1 1 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 1 1 1 1 1 1 1 1 1 1 1 1 1 1?42?(3)?(4?)?1192.1.1.0/24?1?2192.1.5.0/24R1?R3?192.1.5.0/243?3192.1.6.0/24R1?R2?192.1.6.0/244?4192.1.7.0/24R1?R2?R4?192.1.7.0/248?R1?192.1.x.x?43?(1)?192.1.6.0/24?192.1.7.0/24?192.1.6.0/2
26、3?(6?)?192.1.1.0/24-E0192.1.6.0/2310.1.1.2L0192.1.5.0/2410.1.1.10L1?2?6?3?(2)?R1?L0?IP?(1?)?3?(R1?R2?R4)?192.1.7.211?IP?TTL?64-3=61?(1?)(3)R1?LSI?Prefix?”0.0.0.0/0”,Metric?10?(1?)?Prefix?”0.0.0.0/0”?Metric?10?44?CPU?(1)?M?32?4B?4?4?4B?1B?(2?)(2)?4?A?4B?(2?)(3)?bne?1446FFFAH?2B?OFFSET?OFFSET?FFFAH?-6
27、?(1?)?bne?PC?4?PC?08048118H?191 1 1 1 1 1 1 2.1.6.0?(6?)?-1010101 10101 1010 0 0.1.1.210.1.1.1 1 1 1 1 1 1 1 10 0 0 0 0 0 0 0 0 0 0 0?2 2 2 2 2 2 2 2 2 2 2 2 2 2 2?6 6 6 6 6 6 6 6 6 6 6?3?R1R1R R R R R R R R R R R R?L0 0 0 0 0 0 0 0 0 0 0 0 0 0?R2 2 2 2 2 2 2 2 2 2 2 2 2 2?R4R4 4R4R4R4R4R4R4R4R4R4R
28、R4R R R4R4R R R R R R R R4R R R R R R R)?1919191919 9 9 919 91919 9 9 9 9 9 9 9 9 9 92 2 2 2 2 2 2.2 2 2 2.2.2.2 2.2.2.2.2.2.2.2.2.2 2.2.2 2 2.2 2 2 2 2 1.1.1.1.1.1.1.1.1.1.1 1.1.1.1.1.1 7.7 7 7 7 7 7 7.7 7 7 7 7 7 7 7 7 7 7 7 211LSLSLSLSLSLSLSLSLS SLS S S S S SI I I I I I I I?08048100H?18H?24?-24/-
29、6=4?(1?)?bne?(PC)+4+OFFSET*4?(1?)(4)?2?3?4?6?2?3?4?6?(3?)?6?(1?)?6?3?(1?)?1?1?2?2?3?3?4?5?6?2?3?4?6?3?3?3?45?Cache?TLB?(1)R2?i?iN(1000)?i?i?1000?(1?)(2)C ache?16?32?Cache?16*32B=512B?(1?)P?6?24?(32B)?0804 8100H?Cache?P?Cache?Cache?1000?1?Cache?(10006-1)/(10006)=99.98%?(2?)?1?(3)?4?sum+=Ai?A?2?5?i?i?
30、1000?(2?)?3?(1?)?A?A?A?(2?)?TLB?1000?TLB1000?A?A0?TLB?A0?TLB?A0?TLB?TLB?1001?(2?)?1?4?(?1?2?5)?1?0?2?load?3?TLB?1002?TLB?3?TLB?)?i?)?Cache?161616 616161616 61 16 6*3*3*3*3*3*3*3*3*3 3 3*2B2 2 2 2 2 2 2 2=512B?(3(3(2B)?0804 8?Cache?1?8%?(2(2(2(2(2(2(2(2?)?sum+=A A A A A A A A A A A A Ai i i i i i i i
31、 i?2?5 5 5 5 5 5 5 5 5 5 5?i i?i?2?)?A A A A A A A A A A A A A A A?A?46?(1)?200?30?29?29?58?30?1?59?(1?)F?(1?)(2)?30?29?29?29?1?29?(1?)?31?(1?)4?32?232=4G?1KB?1024B?4B?1020B?4G1020B=4080GB?(2?)?(1)?2?1024232B=4096GB?1?47?mutex1?mutex2?empty?full?mutex1?(10?)?1?mutex2?1?empty?0?full?1000?semaphore mu
32、tex1=1;semaphore mutex2=1;semaphore empty=n;semaphore full=0;producer()while(1)?;P(empty);/?P(mutex2);/?;V(mutex2);/?V(full);/?1consumer()while(1)P(mutex1)/?10?for(int i=0;i=10;+i)P(full);/?P(mutex2);/?;V(mutex2);/?V(empty);/?;?31?1K1K1K1K1K1K1K1 1K1 1K K1 B B B B B B B B B?4G4G4G4G4G4G4G4 4G4G4G G4
33、G4 4 1?1?mutex2?emememe ememememememem m m me pt p p p p p p p y?fu u u u u u u u ul ll l ll ll ll l l l ll l l l l?mu umumute te te te te e e te te te e te e ex x x x x x x1 1 1 1 1 1 1 1 1 1?1?mu u u u u u u u ute te te te te te te 2 2x2 2 2 2 2 2 2 2 2 2?0 0 0 0 0 0 0 0?fufufufufufufufufufu u ul
34、ll l l?or r r r r r re e e e e e e e e e e e e e e e e e e m m m m mumum m m mumumum mumumu um mumumum m mumumumumumum mumumumute t t t t t t t t t t t x1=1=1=1=1 1=1=1=1=1=1 1=1=1=1 1=1 1 1 1 1 1 1 1;aphphph hph h h hph h h h hphphph ho o o oro o o o o o o o o o o e mumumu umumumumum mumum mu umu u
35、 u u umu u u u u u u u u ute te te te te te te te te te te e te te te t t te e t t x2x2x2x2x2x2x2x2x2x2x2x2x2x x x2x x x1 1 1 1=1=1=1=1=1=1=1=1=1=1=;ema a a a a a a a a a a a a a aphphp phph h h h hphp ph hp php p p p phph h h hp ph h h h hp orororororororororo orororororo o o oro e e e e e e e e e
36、e e e e e e e e e e e e e e ememememe eme ememememem mpt pt pt pt pt pt pt pt pty=y=y=y=y=y=y y=y=y y y y n;n;n n n nsemamamama amamamamamama amamamamam php p p p p p or r r r r r r r r r r r r r r re e e e e e e e e e e e e e e e fufufufufufufuf fuf f ll ll ll ll ll ll ll ll ll l l=0=0=0=0=0=0 0 0;
37、prod d d d d d d d d d d d d d d d du u ucu u u u u u ucucucucucucucucucucucu ucucu u er r r r r r r r er er er er er er er e er e er er e e e()()()()()()()(whwhwh hwhwhwhwhwhwhwhwhwhwhwhwhwh hw w il il il il il il l il il il il l il i il le e(e e e e e e e e e e e 1)?;P(ememememememememememem m m m m mpt pt pt pt pt pt pt pt pt pt pt pt pt pt t p p y)y)y y)y)y)y y)y)y)y)y)y)y)y y)y)y y y);P(P(P(P(P(P(P(P(P P(P(P P(P P(P(mutex2);?mutex2);V(mutex1)?2?1?2?1?2?-?3?10?6?