An algorithm is a self-contained step-by-step set of instructions to solve a problem. It takes time for these steps to run to completion. The time it takes for your algorithm to solve a problem is known as time complexity.
Here is the official definition of time complexity. The time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the length of the string representing the input.
That sounds like a mouth full and you are probably trying to understand exactly what that means. In simple terms, time complexity is defined by the time and space required by a particular algorithm.
It is not unusual to find many different methods that you can use to solve a problem. The length of time it takes and the number of operations taken are used to determine how effective your algorithm is in solving the problem. Complexity helps programmers to understand, and therefore improve, the efficiency of our code.
Week 4 is considered the hardest week at Hack Reactor. In fact it is so challenging that at the end of Week 3 we had a special meeting to discuss what to expect for this week.
When the instructors tell you point blank that it is not uncommon for people to feel completely lost and totally confused then you wonder what is in store for you.
Week 4 is our first foray into building complete full-stack applications. During this week we will learn about NodeJS and handling asynchronous event loops. Mid week we transitioned into learning about data storage structures and server side concepts. The end of the week we jumped head first into databases.
You might ask what is the difference between the two? Does one provide better performance than the other? Is one better to use than the other?
The best way to understand the difference between the two is to examine the pseudo syntax for each.
function.call(thisArg[, arg1[, arg2[, ...]]]);
A closure is a function object that retains ongoing access to the variables of the context it was created in (even after the outer function calls it was created within have returned).
In other words, the function defined in the closure ‘remembers’ the environment in which it was created.
Let me give you an example:
var firstName = 'Jennifer';
After completing my 3rd week, I realized that I am one quarter of the way through my training at Hack Reactor. Unofficially next week I will have graduated from a Freshman to a Sophomore.
Week 3 is historically considered the hardest week at Hack Reactor. After just completing that week I can agree whole heartedly with that assessment.
Monday of Week 3 started with our self-assessment. We are giving a short time period to complete an assessment that tests our knowledge of the material covered in the previous week.
Our assessment this week was to:
- Rewrite a function declaration into pseudo-classical
- Write a function to find duplicate characters
- Utilized several D3 functions
- Describe time complexity of several algorithms