Sunday 24 February 2019

Recursive Recurring Recursion

Oh no, here we go again. It seems like recursion is a topic where you first must understand recursion to understand recursion. Jokes aside, we have all encountered recursion at some point. For some people, it was crystal clear to understand, for others, not so much. When I was first introduced to recursion in high school, I was told the same as most others:

  1. Find the base case
  2. Recursive Step
  3. Trust your code

It appeared as if teaching to trace recursion and discussing about the role of the call stack was primarily disregarded. These same steps were repeated in university, and I was confused because I did not have a good understanding of how the computer reads recursive code. Nevertheless, this seemed like a perfect learning opportunity, and no method of learning is better than trying to explain the concept to someone else!

Let's start by taking a random function f(N), and let this function have a recursive call in it. In python, we have a separate call stack on the side that tracks each call to this function. Afterwards, the function will break down into smaller sub-problems, until the problem cannot be broken down anymore. During this process, each call to the function is pushed into the call stack. 


Once the broken down function has reached the base case, each function call is popped from the call stack until the size of the stack is zero. Each time a function call is popped, its result is obtained  with the information from all the previous function calls. Lastly, when there are no function calls left in the call stack, the function returns the result of the last function call in the call stack.

Sounds confusing, right? Let's take a look at a popular example, the factorial of a number. Now, constructing the code is easy. It looks something like this.


Again, let us take the function factorial(N), as well as a call stack. factorial(N)will break the problem down to smaller function calls, and these function calls will be pushed in the call stack. This is done until a function call has reached the base case.
Going back to our call stack, we now pop each item from the stack, and storing the output alongside it. The item on top of the stack will always be the base case. Furthermore, this value is stored, and then we pop the next item in the stack. This is now f(n + 1) or f(2) in this case, which is equivalent to 2 * f(1). Since we already know that f(1) = 1, we now have enough information to solve f(2) = 2 * f(1) = 2 * 1 = 2. Now it is know what f(1) and f(2) is. With this information, we can now solve 
f(3) = 3 * f(2) = 3 * 2 * f(1) = 3*2*1 = 6. This repeating process can be done all the way to the original problem f(N), which will produce the answer. Let's take f(5) as an example, then the recursion will be as follows.
In summary, the answer is always returned by smaller sub-problems. Having a good understanding of the importance of the call stack, as well as the breaking down of problems, is crucial for a better understanding in tracing recursion.

With this understanding in mind, it is easy to see how the computer looks at recursive functions. It is just as easy as explaining to a 5 year old how recursion works! Just explain to a person one year younger than you, and let them explain to a person one year younger then them. Continue this process until you have a 6 year old explaining to a 5 year old! 

That's it for me today, i'll see you in a couple of weeks! Bye-Bye!






Sunday 10 February 2019

The Opinionated Orator

When I think of an excellent public speaker, I think of a person who informs, persuades, and entertains others with their speeches. Only one person came to mind, though I was very hesitant to write at first. This was due to their seemingly never ending controversies, along with their questionable political views. If you have not guessed already, this person is none other than Donald J. Trump.

In this post, I will be excluding anything to do with the politics and controversies of Trump. Instead, I will focus solely on his ability to deliver speeches, and why I believe Trump is an exceptional orator. 

To begin, what speech comes to mind when you hear the name Trump? For most, it would have to be the "Make America Great Again" inauguration speech, or the "Build a Wall" presidential campaign speech. Looking back at the three characteristics that I mentioned above, are his speeches informative, persuasive, and entertaining?

For many people, the content of most of Trump's speeches are usually forgotten within days. This is largely because of their sporadic nature and the lack of an overarching focal point. Trump does not like to stay on one topic, does not attach anecdotes or meaningful stories, and does not personalize his speeches to grab the attention of the audience. Then how can Trump be exceptional at delivering speeches when he neglects most of the fundamentals? For me, it is his deviation from what is expected that makes him memorable. It is his unique ability to entertain and persuade others that makes me truly appreciate his skills as an orator.

Most people will have watched compilations of Trump speaking publicly in some way, whether he is talking about his business, politics, or personal life. Trumps body language, as well as his choice of words, makes it entertaining and memorable for the viewer. Each unique hand gesture is subconsciously conveying meaning to the audience, making his speech more engaging. His simple, yet stark, word choice paved the way for memorable phrases such as "Build the wall" and "Believe Me". Trump is an interesting politician because ironically, he does not speak like one.


Most importantly however, is his ability to persuade an audience by verbalizing what they already believe. No speech is more memorable to me than when Trump spoke in my home country of Poland. He praised the Polish people for their tenacity in fighting for their freedom. For having courage and fortitude to fight for what is theirs, even after multiple partitions had erased them from the world map. With this in mind, he stated that Poland looks after its people first, and that is what America has strayed away from.

Trump knew about Poland's troubled past, and used this knowledge, alongside his speaking skills to form a relationship with the Polish community. He went from an unrecognized face to being praised as highly as St. John Paul II. Many Polish citizens were putting Trump on the highest of pedestals, praising him for verbalizing what they already knew. He set out to Poland with one goal in mind: to persuade the people, and he did exactly that.



To conclude, while Trump is often not the most informative speaker, his skills in entertaining, as well as persuading is unlike any other public speaker I have seen before. From being a public laughing stock when he decided to run for office, to proving everyone wrong and becoming the President of the U.S.A., Trump was able to achieve what so many thought was impossible. Why? I only see one reason, his public speaking skills.


Why do you guys think about this opinionated orator? Do you believe Trump is an exceptional public speaker? Let me know in the comments below. That's it for me today, I will see you all in a couple of weeks, Bye-Bye! 






Sunday 3 February 2019

Solitary Breakout


What comes to mind when you hear the words solitary breakout? For me, it symbolizes breaking free from your personal mental confinements. Ironically, this was also the name of my first major project in high school.

If you have read my previous blog post, you would have already known that I was not the most social person in high school. I liked to do things in isolation as I felt that collaboration with others caused too many problems. Thus, I avoided group work until the final project of my grade 12 programming class.

The project was done in groups of 4 to 5, and these groups had to create a fully playable video game. Multiple aspects of project development were involved, such as pitching, marketing through poster/video advertisements, game design documentation, prototype development, and a final gold master release.

Staying true to my high school self, I had a pessimistic view of this project, largely due to the collaborative nature of it. I knew that I had no choice but to cooperate with others and, as such, I took this opportunity as a learning experience.

The game engine we used was Unity, as the group was really interested in working with 3-D models. The premise of our game was an obstacle course not unlike the show Wipeout. The objective was to lead your character from point A to point B, whilst avoiding dangerous obstacles along the way.




Our team met twice a week, often at one of our houses where a large table could be setup. A typical meeting could be summarized as everyone staring at their laptop with two boxes of pizza, Doritos, and Mountain Dew on the side. I hate to admit that it was a largely painless and enjoyable time. I was amazed at how much could be achieved when you put multiple heads together. 

As with any project, there were difficult times. Conflicts occurred, meetings dragged into the early hours, errors never disappeared, and lots of compromises were made for the final game. When the product was completed, I was a bit nervous of how others might react. The next stage was to let hundreds of our fellow students demo the game!

Yet this moment was perhaps my most memorable experience in high school. Seeing others react to something you’ve made provides a surreal sense of accomplishment. A lot of people were happy and enjoyed playing the game, but oddly, the most interesting reactions were the ones from people that became angry or frustrated at the game! These reactions were the real learning experiences for us.

Being part of an experience like this gave me a rudimentary idea of what it was like to be a video game developer. It showed me a perspective that I was afraid to explore and discover. It was the moment where I truly realized that team work makes the dream work.

This is when we come back to the idea of  Solitary Breakout. Before this project, I was stubborn about working and socializing with others. I think this stagnated my growth as not only a computer scientist, but as someone who would inevitably need to interact and work with others. I was putting myself in my very own solitary confinement. This project made me escape this confinement and made me realize the importance of others in your personal growth as an individual. I alone could not have achieved what was done by the group and, to conclude, I was as proud of making our vision become a reality as I was of achieving my personal solitary breakout.






So, when have you achieved solitary breakout? Let me know in the comments below. That's all for me for today, I will see you all in a couple of weeks, Bye-Bye!

The Roads Untraveled

At the beginning of my CSC290 journey, I introduced myself as an Ambivert. An ambivert that wanted to benefit from both qualities of introve...