

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















Q.enqueue(n)
n=Q.dequeue() # exception if empty Q.size()
Q.isEmpty()
Q.enqueue(n)
n=Q.dequeue() # exception if empty Q.size()
Q.isEmpty()
Let T(n) be a monotonically increasing function that satisfies: T(n) = aT(n/b) + Θ(n d^ ) Where a≥1, b>1, d≥0.
T(n) is Θ(n d^ ) if a < bd T(n) is Θ(n d^ log n) if a = bd T(n) is Θ(n log a b^ ) if a > bd
a is number of sub- problems 1/b is size of sub- problems nd^ is cost within a given level
Returns k th^ smallest element in list
Divide and conquer
Returns k th^ smallest element in list
Divide and conquer
Pick pivot, v
Create three sub-lists
Find which sub-list k is in from sub-list sizes
Return Selection(k (^2) , appropriate-sub-list)
Pick pivot, v
Construct 3 lists, SL, SV, SR
Quicksort(SL)
Quicksort(SR)
Return(SL,SV,SR) append now-sorted lists
Search and optimization heuristic
Mimics natural evolution Genome for candidate solutions Mutation, selection, inheritance, and crossover
http://www.youtube.com/watch?v=JBgG_VSP 7f8 (example of Karl Sims)
http://vimeo.com/ 12058493 (tribute)