Skip to main content

Algorithms

Coding gets harder sometimes, getting difficult to understand and to think of to get it to work exactly how it's supposed to in order to solve a certain problem. One way to help make the process simpler/easier is by creating an algorithm for your code before you start typing or even touch the keyboard. An algorithm is a sequence of step that should be followed to achieved a goal.
As an example, we can list the basic steps required to watch a video on youtube.

The steps:
1- Turn on computer
2- Connect to internet
3- Open web browser
4- Type address in title bar
5- Search for desired video 
6- Watch it

Some challenges one might face with this algorithm include for example having a web browser that support using youtube and another would be the required memory for the browser to play videos without crashing and/or turning off the computer as what happens usually with older ones.

Comments

Popular posts from this blog

Stack vs. Queue

Stack is like a pile of  books placed on top of each other. We can add new books to the top and can remove them from only the top because stacks are LIFO which means last-in, first-out. Queues on the other hand are the opposite, which is FIFO meaning first-in, first-out. So adding an element to the queue will be the same but removing will happen to the first element not the last one. An example of a queue would be the wait line in front of any kind of service we see around us like the bus station or the shops,....etc.

Middlewares

Middlewares in Javascript are functions that come in the middle of the request-response cycle. They have access to both the request and the response object as well as the next middleware function to be executed; usually called next(). Popular examples on middleware include: body-parser, cors, session, cookie-seesion and cookie-parser.