Free Essay

Sdfsd Is D

In:

Submitted By sunny08030601
Words 473
Pages 2
1.
a. The number of nodes at level h is at most d^h. The total number of nodes in a tree of height h is at most 1 + d + ... + d^h = Θ(d^h). Setting d^h = n implies the height is
Θ(logd n).

b. same as binary heaps. running time is given by Heapify. Heapify operation on d-ary heaps is similar to the one on binary heaps:

Heapify_D(A, i)
i. find largest element l = max{A[i], Children(A[i])} ii. if l != i then exchange A[i] ↔ A[l] and Heapify D(A, i)

The running time of Heapify d is Θ(d · logd n). The d term is because at each iteration a node compares its value and the values of its d children to find the maximum, which takes O(d) time.
c. same as binary heaps. The running time is Θ(height) = Θ(logd n).
d. The running time is O(logd n) if A[i] < k.
Heap_Increase_Key _D(A, i, k)
i. if A[i] < k then
A[i] = k while i > 1 and A[Parent(i)] < A[i] do exchange A[i] ↔ A[Parent(i)] i = Parent(i)

2. log(n!) = log(1) + log(2) + ... + log(n-1) + log(n) log(1) + log(2) + ... + log(n) <= log(n) + log(n) + ... + log(n) = n*log(n) log(1) + ... + log(n/2) + ... + log(n) >= log(n/2) + ... + log(n)>= log(n/2) + ... + log(n/2) = n/2 * log(n/2)
3.
T(n) is the best-case time for the procedure QUICKSORT on an input of size of n.
T(n) = min (T(q) + T(n − q − 1)) + Θ(n))
1≤q≤n−1
We guess that T(n) ≥ cn lg n
->
T(n) ≥ min (cq lg q + c(n − q − 1) lg(n − q − 1)) + Θ(n) (1≤q≤n−1)
= c min(q lg q + (n − q − 1) lg(n − q − 1) + Θ(n) (1≤q≤n−1)

Choosing q = (n − 1)/2 gives us the bound min(q lg q + (n − q − 1) lg(n − q − 1) >=(n-1)/2*lg[(n-1)/2]+[(n-(n-1)/2-1)]lg(n-(n-1)/2-1)=(n-1)lg[(n-1)/2]
Continuing with our bounding of T(n), we obtain, for n ≥ 2,
T(n) ≥ c(n − 1) lg [(n – 1)\2]+ Θ(n)
= c(n − 1) lg(n − 1) − c(n − 1) + Θ(n)
= cn lg(n − 1) − c lg(n − 1) − c(n − 1) + Θ(n)
≥ cn lg(n/2) − c lg(n − 1) − c(n − 1) + Θ(n) since n ≥ 2
= cn lg n − cn − c lg(n − 1) − cn + c + Θ(n)
= cn lg n − (2cn + c lg(n − 1) − c) + Θ(n)
≥ cn lg n
->故得證

Similar Documents

Free Essay

Life

...sdfs df f sdfsd fa dfd fd fsdf sd f sdf dsf dfsdfnsd fnds fn sdf dnf sd snd dg gnf gn gfn dfng ndf ndg sgn dfgn fgn fdgnf g dfg fg fgnsf ng nfg nfg fgn fgnfg ngf fng nfg fgn fdnfg fgnf nsf nsdg fng fn fgnfg n dnf dnfgng fg ng fgn dgndf ng sg gf nsgngnf gn fngfng fng fng fng fgn fgn fgnfg ndf nf g fgn gnf gn fgn fn fgsn fn sg gng nfg fgn fgnfg nfg nfg fn nfg nfg bfdan rnt th thn rng ntg ne etr en ne gnfn fjrb r nr rer ej ww edm rne rnqwer we erne f gf df wdf df fgf g g fg g g g g g df e rf r r r e re r er r4t t t 6y y uuy uii u u i u i i i i u t df d fg fg f f. life is as real as you make it fsddgggggggggggggdsaaaaaaaaaaaaaaaaaagg ds hdn fbn fndf hddhgdgfhdsf afha fhdfhdff dbf bdf ndf asnf af ddadssdfsdf df f s df dsfdf sdfs df f sdfsd fa dfd fd fsdf sd f sdf dsf dfsdfnsd fnds fn sdf dnf sd snd dg gnf gn gfn dfng ndf ndg sgn dfgn fgn fdgnf g dfg fg fgnsf ng nfg nfg fgn fgnfg ngf fng nfg fgn fdnfg fgnf nsf nsdg fng fn fgnfg n dnf dnfgng fg ng fgn dgndf ng sg gf nsgngnf gn fngfng fng fng fng fgn fgn fgnfg ndf nf g fgn gnf gn fgn fn fgsn fn sg gng nfg fgn fgnfg nfg nfg fn nfg nfg bfdan rnt th thn rng ntg ne etr en ne gnfn fjrb r nr rer ej ww edm rne rnqwer we erne f gf df wdf df fgf g g fg g g g g g df e rf r r r e re r er r4t t t 6y y uuy uii u u i u i i i i u t df d fg fg f f.life is as real as you make it fsddgggggggggggggdsaaaaaaaaaaaaaaaaaagg ds hdn fbn fndf hddhgdgfhdsf afha fhdfhdff dbf bdf ndf asnf af ddadssdfsdf df f s df dsfdf sdfs df f sdfsd fa dfd fd...

Words: 737 - Pages: 3

Premium Essay

Asdfg

...Qwe D fsd dfdsd d sdsdf Sdshdjh sk Sdfsfdfdsf sdffdfsdf Sdfsd Fsd Fd Fsd fzdfjvjdfhbvzfdjh vgzdfjhvhdfjgjhfdshfhdksgdfjs hghjdfghajsgjdhfasjhfghjkjhgtuwertewry ugfdjhgspdgdfvbregb r esgbzfd hjvgdfkjgk hjkgfhjdghs djfgjhsdf Sdfds F Ds dfjhdf dfjhdf dfjh eiruyi erejdf dhdjf d djhjd hdfj dfhjhd hdfj dfjhjdhf j dhjhjd fjhdj dj j j j j j j j jj j j j j j j j hh hjhj hjh jhj F Ds Fsdfsdfsdfdsfdsf Sfds F Sd Fds F Dsds F Dsf Ds Fsfds F Ds Fsdfdsfsdfdsfsdfdsfdsfsbsdhjajhfhdsagasjkhsdfgjhafgkshdsjhvz kdjhvbzxcvjzdfhvbfjhgzbvdfgvzdfjhvbzfdjhvbzdfvfdjhgvfdbvzdfb vjfhdgbzdfjbv hgh ghgh ghg ghgh ghg gh gh g h hg h hg h h gh hg h hg g h h h h h h h h h h h h h h h h h h h h h h h h h h h hhh h h h h hhhhh hh h hhh h h hhh h hh Qwe D fsd dfdsd d sdsdf Sdshdjh sk Sdfsfdfdsf sdffdfsdf Sdfsd Fsd Fd Fsd fzdfjvjdfhbvzfdjh vgzdfjhvhdfjgjhfdshfhdksgdfjs hghjdfghajsgjdhfasjhfghjkjhgtuwertewry ugfdjhgspdgdfvbregb r esgbzfd hjvgdfkjgk hjkgfhjdghs djfgjhsdf Sdfds F Ds dfjhdf dfjhdf dfjh eiruyi erejdf dhdjf d djhjd hdfj dfhjhd hdfj dfjhjdhf j dhjhjd fjhdj dj j j j j j j j jj j j j j j j j hh hjhj hjh jhj F Ds Fsdfsdfsdfdsfdsf Sfds F Sd Fds F Dsds F Dsf Ds Fsfds F Ds Fsdfdsfsdfdsfsdfdsfdsfsbsdhjajhfhdsagasjkhsdfgjhafgkshdsjhvz kdjhvbzxcvjzdfhvbfjhgzbvdfgvzdfjhvbzfdjhvbzdfvfdjhgvfdbvzdfb vjfhdgbzdfjbv hgh ghgh ghg ghgh ghg gh gh g h hg h hg h h gh hg h hg g h h h h h h h h h h h h h h h h h h h h h h h h h h h...

Words: 270 - Pages: 2

Premium Essay

Enviroinment

...La vidagggggggggggggggggggggggggggdgsdsdf dfsdfsd sdfsd dfs sdf sdf sdf sdff dff sdff sdfsd sd sdffsdfsgd bks hkasuhaliufhaskdha; a asfkjh g;ruhgp wef fywehfwefwee wfh;lfh ;lasafh a;sdih s fa;sfh a;sfh a a a a a a a a aa a a a a a a a a a a a a a a a a a aa a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ajxsjd ju u u u u u u u 8 8 8 8 8s asd a a a a d d cd s s s xc c c c rf r r r e e e s s s s s s s fg fg f f f f f f f f f f f fd df d d d dd d d d d d dd d d d d d d d d ds s s ss s s s s s s s s s s s s s a a S X X EW D E S WS S S X S X HFNH K K K K K K K K K K I I I IC C I I I I I I I I I I I I I I I 8 89 9 9 9 9 9EDNE E E E E T T T 56 55 5 5 5 RR R R R F F F V V V...

Words: 264 - Pages: 2

Free Essay

She All on Me

...Do your own work meat head asdflakdjfadf daflkjasdf asdf asdfasdf asdfasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asd fasdf as fasd fas fasd fasd fasd fas f sdf asdf asdf asdf asd fasd fasd fasd fas df asdf asd fas dfas df asdf asd fasd f asdf asdf asd fasd fasd fasd f asdf asd fasd fasd fasd f sdf asd fsd fsd fsdf sdfsd fsd f sdf sddf df as fasdf asdf asdf asd f sdf asd fasd fas df asdf asdf sd fas fa sf asdf asd fas df asdf as fas df asd fas df asd fasd fas dfa sdf asd fasd fa sdf asd fasd fas df asdf asdf asd fasd f asdf asdf asd fasd fasd fasd fasd fs fsdfasd f asdf asdf sadfasdfjsdlkfj j sdkfjsd sdlkfj flkj klasj dklfjlfk sldkfj sdfj sdfasd sd asd f asd fsd f asdf asd fasd f f sd fasd fsad fasd f asd fsd f asdf asd fasd f asdf asd fasd fasd f sdf asd fds fasd f sdf asd fsd fasd f asd fasd fas f sd fasd fsd f asd fas df asd fasd f sdf ds fsd f dd d d d d d d d d df sdfasdf adf asdf asdf asdf asd fasdf asd fasd fas df asdf asd fasd fas df asdf asd fasd fas df sdf asdf dasf asdf asd fasdf asd fasd fasd f asdf as fasd f asdf asdf asd fasd fas dfas df asd...

Words: 253 - Pages: 2

Premium Essay

Finance

...abcedfghijklmnopqrst abcedfghijklmnopqrst v abcedfghijklmnopqrst abcedfghijklmnopqrst abcedfghijklmnopqrst v akd wlekfw r r wefw efw ef wef we few few few few few few few few few fw ef wef wef wef we few few f wef wef wef we few few f wef wef we fw ef wef wef we fe f ef f f f f ef we few fw ef wef ewf wef wef w efw ef wef we few we fw ef wef wef we fw efw ef wef we dw edw ed wed wd wd wd d as as a sd as da sd as da sd as da fg d hgr th ytj uk yu kyu k yj ty hrt g er we d as dsd gfd h yjt t i uy ik tr g ef as fs gd th ytu t i tyrh rs fw ef w er yr ru rt eg sd fa dfwe t ery rt h d e rfer ge rg rthr th rth rth rth rth rth rt hr hku k ilu rtye rwf ads dfg hyj tuky ku jy htg fd scwe e ewrt tr jfy j m j kki ky yjdgf sdf as dwa wqe er ewf rge t yjtyuk i jh hn bgv sdfsd ad wqe wqe ewr rte yrt u iyuk hk jhgfn bc v cs as asd ad sf gr tg ht hgm mb sd ads ad fse rg hfj yju da de we re et try tyu u jg h fg sfse f ret ety hy jg gj gh g ea fs et ty f f s fs f f sf s rgrdg h fh fh fh fh...

Words: 270 - Pages: 2

Premium Essay

Ap Chem Stoichiometry

...AP Chemistry Summer Assignment Mr. Ronnenkamp Welcome to SPHS AP Chemistry!! You already have a background in chemistry from your General Chemistry class, but AP Chem is very different. Rather than memorizing how to do particular types of problems, you must really understand the chemistry and be able to apply it to different kinds of problems. AP Chemistry is a challenging course. To succeed, you must keep up with the assignments and be willing to spend time working through the material. Like all AP classes, AP Chem comes with a summer assignment. It is due the second day of class - August 25th - and will count as ½ of a test grade. ALL YOUR ANSWERS FOR THE SUMMER ASSIGNMENT SHOULD BE PUT ON ANOTHER SHEET OF PAPER!!!! We will then have a CLASS TEST on the SUMMER ASSIGNMENT ON 9/1/2015 (depending on schedule)!!! This class test will count as the second ½ of your first test grade. I check my e-mail frequently, so feel free to contact me if you are having problems doing the summer assignment. I can offer help via email. My e-mail address is: ronnenkampd@pcsb.org Please take the summer assignment seriously. Completing the summer assignment will allow you to enter AP Chemistry in August ready to succeed!!!! Each section of the summer assignment is referenced with web tutorials to help you if you have forgotten some of your General Chemistry, but feel free to use any good website. I will also be giving you access to an online textbook. ONLINE...

Words: 1242 - Pages: 5

Premium Essay

Hi Hi

...Sdfsd fsssssssssssssssssssss sssssssssssssssssssssssssssssssssssssssssssss ssssssssssssssssss sssss ssssss sss sssssssss ssssssss ssssssssssssssssss ssssssss sssssssssss fsdferwerwerwerwer Wer W W Er W Er W Werw EASHINGTON (AP) -- The Obama administration on Monday will roll out a plan to cut earth-warming pollution from power plants and 30 percent by 2030, setting in motion one of the most significant actions to address global warming in U.S. history. The rule, which is expected to be final next year, will set the first national limits on carbon dioxide, the chief gas linked to global warming from the nation's power plants. They are the largest source of greenhouse gases in the U.S., accounting for about a third of the annual emissions that make the U.S. the second largest contributor to global warming on the planet. The Environmental Protection Agency regulation is a centerpiece of President Barack Obama's plans to reduce the pollution linked to global warming, a step that the administration hopes will get other countries to act when negotiations on a new international treaty resume next year. Despite concluding in 2009 that greenhouse gases endanger human health and welfare, a finding that triggered their regulation under the 1970 Clean Air Act, it has taken years for the administration to take on the nation's fleet of power plants. In December 2010, the Obama administration announced a "modest pace" for setting greenhouse gas standards for power plants...

Words: 820 - Pages: 4