It’s a misnomer used to describe servers in the cloud that requires zero configuration or maintenance from the developer. Imagine you need water for your house. You could spend a bunch of time and money digging a well, testing the water quality, and plumbing it to your house or you could just tap into the city water supply and pay a monthly fee based on the amount of water that you use.

Serverless computing is the same idea but instead of water, we’re talking about the amount of CPU and memory it takes to run your code. Services like AWS…

  • This is done by taking the help of some function or algorithm which is called a hash function to map data to some encrypted or simplified representative value which is termed as “hash code” or “hash”. This hash is then used as an index to narrow down search criteria to get data quickly.
  • Hashing can be considered as a significant improvement over DAT to reduce the space complexity.
  • In our example of the employee system that we have seen in the introduction part, we can simply pass the employee ID to our hash function, get the hash code and use…

  • In simple words, here, it is believed that the locally best choices made would be leading towards globally best results.
  • In this approach, we never go back to reverse the decision of selection made which is why this algorithm works in a top-bottom manner.

Advantages of Greedy Approach:

  • It is easier to describe.
  • It can perform better in most of the scenarios than other algorithms.
NOTE: We have mentioned “in most of the scenarios” in the earlier point because in some cases, this approach doesn’t always produce correct results due to the nature of not reversing the decision made. …

There are 2 popular approaches of doing graph traversals :
* Depth first search ( DFS )
* Breadth first search ( BFS )

Example Implementation Of Bfs And Dfs

DFS Algorithmic Steps

Step 1: Push the root node in the Stack.
Step 2: Loop until stack is empty.
Step 3: Peek the node of the stack.
Step 4: If the node has unvisited child nodes, get the unvisited child node, mark it as traversed and push it on stack.
Step 5: If the node does not have any unvisited child nodes, pop the node from the stack.

Based upon the above steps, the following Java code shows the…

  • It is known for solving problems recursively one step at a time and removing those solutions that do not satisfy the problem constraints at any point in time.
  • It is a refined brute force approach that tries out all the possible solutions and chooses the best possible ones out of them.
  • The backtracking approach is generally used in cases where there are possibilities of multiple solutions.
The term backtracking implies - if the current solution is not suitable, then eliminate that and backtrack (go back) and check for other solutions.

Backtracking — How it works?

In any backtracking problems, the algorithm tries to find a…

These algorithms take an input list, processes it (i.e, perform some operations on it) and produce the sorted list.

The most common example we experience every day is sorting clothes or other items on an e-commerce website either by lowest-price to highest, or list by popularity, or some other order.

Sort Implementation Details

C++ Sorting vector V,

sort(V.begin(), V.end());

Bubble Sort

Bubble sort, also referred to as comparison sort, is a simple sorting algorithm that repeatedly goes through the list, compares adjacent elements and swaps them if they are in the wrong order. This is the most simplest algorithm and inefficient at the same time…

Maths ( especially discrete mathematics ) and computer science go very much hand in hand.


The factor of a number, N is a number d such that d divides N.
That is, N % d == 0.


For number 6, the factors are 1, 2, 3 and 6.

Question 1: All Factors

Given a number N, find all factors of N.

N = 6
factors = {1, 2, 3, 6}


Time Complexity: O(sqrt(n))

Question 2: Verify Prime

Given a number N, verify if N is prime or not.


So, two-pointer ( or N pointer for that matter ) is usually a really clever optimization on some brute force approaches in certain conditions.

Let us start looking at this with the help of a question. Then we will generalize our approach.

Question 1:

Given a sorted array A ( sorted in ascending order ),
find if there exists 2 integers A[i] and A[j] such that A[i] + A[j] = 0, i != j

Now the naive solution would be,

This solution is O(n²).

However, let us now analyze how ‘i’ and ‘j’ move with iterations. Clearly, ‘i’ moves forward with every…

A *writes down "1+1+1+1+1+1+1+1 =" on a sheet of paper*

A : "What's that equal to?"
B : *counting* "Eight!"

A *writes down another "1+" on the left*
A : "What about that?"
B : *quickly* "Nine!"
A : "How'd you know it was nine so fast?"
A : "You just added one more"
A : "So you didn't need to recount because you remembered there were eight! Dynamic Programming is just a fancy way to say 'remembering stuff to save time later'"

This conversation has the essence of dynamic programming.

The idea is very simple, If you have solved…

React, a javascript library for building user interfaces. Developed at Facebook and released in 2013 it’s safe to say React has been the most influential ui library of recent memory.


We use it to build components that represent logical reusable parts of the UI.

The beauty of React is that the simplicity of building a component has been brought down to its theoretical minimum. It’s just a javascript function. The return value from this function is your HTML or ui which is written in a special syntax called JSX allowing you to easily combine javascript with HTML markup.

Tech Bro

Technical Details behind all your favorite products.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store