Week 8 Slog:
This week's lecture consisted the formal definition of O and Ω, worst case analyses and problem solving session. The formal definition for O is "a function f(n) is in O(n^2) iff there exists c in positive real and natural number B such that for all natural numbers n, if n greater than or equal to B, then f(n) is less than or equal to c". At first, this definition was very difficult for me to understand because the idea of breaking point B seemed vague. Luckily, professor spent time talking about this term and used a very good example, which was the idea that 'a chicken grows slower than a turkey after a certain break point." Similarly, a function growing slower than cn^2 beyond a breaking point can be classified as O(n^2). Conversely, the idea of Ω is "beyond a breaking point, function f(n) will always be less than cn^k, where k is a natural number. I find these idea very interesting.
The next section of the lecture was very challenging as it combined coding problems and analyzing worst cases. Initially, the while loop in the examples function body was very difficult for me to understand since I do not often use while loops. Fortunately, my peers are experienced coders and they broke down the code step by step to me. Overall, I found calculating the worst case run time fairly challenging as it required strong code reading skills, yet I believe I would be able to solve these problems with practices.
No comments:
Post a Comment