CSC263H1 Lecture Notes - Lecture 2: Sample Space, Big O Notation, Upper And Lower Bounds
Document Summary
For algorithm a, t(x) represents the number of steps executed by a on input x. Worst case running time of a on inputs of size n is denoted ta(n). T (n) = max{t(x) : x is an input of size n} Linkedsearch(l, k): z = l. head while z != none and z. key != k: z = z. next return z. L. length (# of elements in l) n. T (n) = an + b for constants a, b t (n) (n) We have 2: z != none, z. key != key. For algorithm a, consider sn = sample space of all inputs of size n. to de ne average , we require a probability distribution over sn speci ying the likelihood of each input. Let tn(x) = num of steps executed by a on input x in sn. note: tn is a random variable (assigns numerical value to each element of probability space).