# Archives 2018

## Time & Space Complexity – III

In the previous post I talked about time complexity of simple for loops. In the previous post, I talked about the time and space complexity of simple for loops. I hope you got the time and space complexity of the algorithm with 3 for loops as O(n^3) and O(n^2) respectively. Let’s discuss some more examples,

## Undefined Vs Null

In JavaScript, both undefined and null come under primitive data types. But they are not as simple as a string, number, and boolean. A variable is said to be undefined when it has been declared (for future use) but has no value assigned to it. For example, Line 2 prints undefined in double quotes, i.e.

## Data Types in Javascript

JavaScript is not strict when it comes to data types and use of variables if we are writing codes without using ‘use strict’. None of the code example in this post has been written with ‘use strict’ option. As a result, we can use a variable (without declaring it) and the JavaScript engine won’t have

## Creating a Highlighter in Vanilla JS

I think thrice in recent past I needed a highlighter while coding. Two times, I used the plugin. Once the jQuery plugin, and the second time, a react plugin. Then when I was creating a filter (by the way, filters are my favourite), I needed the highlighter once more. I opened a new tab in

## Time & Space Complexity – II

Click here to go to the previous post. While calculating the space complexity of the algorithm, we established that one variable would take one unit of space. Space Complexity of Algorithm 2 Click here to view Algorithm 2. The easiest way to calculate the space complexity is to list out the variables and add 1

## Time & Space Complexity – I

In simple words, time complexity is the amount of an algorithm takes to execute, and the space complexity is the memory used. In general, if you have ever studied the time and space complexity of algorithms, the one thing that we remember is: for loops are bad. In this first part of the series of

## Sort an Array of Objects

Sorting of data is a common problem. Whenever we check something on the internet, be it clothes, flights, shoes, or any other item, the first thing (most of the time) we do is, sort the result. Each website provides sorting based on price, recommendations, popularity, and so on. So how do we sort data? There