Algorithms

Impress your job interviewer during whiteboarding exams! Learn the proper way of solving problems and algorithms implementation.


Lattice Paths Part 2 (Brute Force Modeling and Iteration)

Starting in the top left corner of a 2 x 2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.

How many such routes are there through a 20 x 20 grid, or any N x N grid?

--

This is the second of a three-part series article about explaining how you could have arrived at the solution yourself in solving the Lattice Paths Problem. If you haven't tried it yet, do it first. I do not intend to deny you of your epiphany moment!

Note: All implementations are written in C/C++.

--

Lattice Paths Part 1 (Brute Force)

Starting in the top left corner of a 2 x 2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.

How many such routes are there through a 20 x 20 grid, or any N x N grid?

--

This is the first of a three-part series article about explaining how you could have arrived at the solution yourself in solving the Lattice Paths Problem. If you haven't tried it yet, do it first. I do not intend to deny you of your epiphany moment!

Note: All implementations are written in C/C++.

--

Techniques How to Remove Any Recursion

A function that calls itself is hard to visualize for most developers. Common software requirements are implemented thru loops, arrays, variables, and automated function calls thus making the use of recursion and variations of the list data structure unusual. In this article, we will take a look at how we can remove any recursive program by following the simple techniques described below. It is very important to understand that this article is not saying that recursion is bad.

How to Check for Matching Parenthesis

Another common whiteboarding question you will be asked is to create a function where you need to check a given expression if all open parentheses have matching close parentheses or vice versa.

An example of expression is: {{[([({{(([]){})){}((((((]}]}}

Evaluating this expression will result to false. 

Arrays

An array is one of the fundamental data structures available and most widely used by developers today to solve general problems. You can think of an array as a collection of variables of a certain data type stored contiguously in memory. The values of an array can be accessed through an index (commonly represented by the variables i, j, and k), and the ith value of an array is denoted as Array[i].

This article is not to be confused with associative arrays, which is a fancy way of calling the key-value-pair data structure. We will discuss it separately.

Pages