Week 2 – CST370 – Design and Analysis of Algorithms
This week we covered asymptotic notations, non-recursive
algorithms, and recursive algorithms.
We use the order of growth to determine an algorithm’s
efficiency. We also use three notations to rank the order of growth: big oh,
big omega, and big theta. Big oh, is the set of all functions with a lower or
same order of growth as g(n), a simple function to compare the count with. Big
omega is the set of all functions with a higher or same order of growth as
g(n). Lastly, big theta is the set of all functions that have the same order of
growth as g(n).
Non-recursive algorithms solve problems by repetition
through loops to execute instructions until a condition is met. An example of a
non-recursive algorithm is a Max Element algorithm where you must find the
value of the largest number in an array.
A recursive algorithm calls itself with smaller values and
returns the result for the current input by carrying out basic operations on
the returned value for the smaller input. An example of a recursive algorithm
is one that computes a factorial function.
I find the puzzles from the weekly material interesting. I like
the fact that they give you multiple solutions and emphasize trying on your own
before reading the solution. This week’s puzzles included 4 Gallon Water,
racing cars, and clock hands.
Comments
Post a Comment