Sign in

Learning Consistently — How To Learn, How To Read, Data Structures and Algorithms. Coding Consistently — JavaScript
Stacks and Queues — DS with JS (Made with draw.io)

Imagine you are at a party and in the queue for getting the food. The person ahead of you is about to take a plate from the very bottom of the stack. Seeing this you try to stop him because he is going to topple all the plates! But you are late, the plates have scattered on the floor. You wait patiently while the new plates are stacked back. Once the plates are back and as you are about to reach for the plate a guy from the end of the queue pops up, in front of you and takes…


In this blog, we will discuss basic operations and implementation of the doubly linked list in JavaScript.

This is a part of the blog DS with JS — Linked Lists. For getting started and the basics of Linked List check it out.

Basic Operations

This is a list of the most common operations performed on Doubly Linked Lists. We will see the usage and their time complexities.

Let us get started with the node representation for the doubly linked list. I will consider a list of some morning habits.

First Node in Doubly Linked List | Morning Habits.

We know a node in the doubly linked list consists of three elements…


In this blog, we will discuss basic operations and implementation of the singly linked list in JavaScript.

This is a part of the blog DS with JS — Linked Lists. For getting started and the basics of Linked List check it out.

Basic Operations

This is a list of the most common operations performed on Singly Linked Lists. We will see the usage and their time complexities.

Let us get started with the node representation for the singly linked list. I will consider a list of some morning habits.

First Node in Singly Linked List | Morning Habits.

We know a node in the singly linked list consists of two elements…


Linked list as the name suggests are linked. A linked list can be used for implementing file systems on the computer, browser history, or resolving hash collision.

In this blog, we will be talking about the singly linked list and doubly linked list. We will start with the singly linked list and then extend it to understand the doubly linked list.

Linking My Morning Routine — Made in Excalidraw

Singly Linked List

Linked lists consist of nodes. Each node has two elements, one the value we want to store and a pointer, pointing to the next node or null.


Hash Tables have different names in different programming languages and come with slight variations. They are called:

  1. Maps in Java
  2. Hashes in Ruby
  3. Dictionaries in Python
  4. Objects in JavaScript

Every language has a built-in hash table just like arrays. Hash tables are very important and extremely useful across computer science. We see them a lot in databases or caches.

Hash Table (Objects) in JavaScript

The hash table or object is a structured data type in JavaScript.

It is used to store various keyed collections and more complex entities. — Object | JavaScript | MDN

Consider you found your dream house and it has many properties…


This is a list of the most common operations performed on Arrays in JavaScript. We will see the usage and their time complexities.

To begin let us consider an array of things I want to own.

const things = ['Books', 'Car', 'Home', 'Money'];
Array — Things I want to own (Made with Excalidraw)

With this list, we will see different operations being performed on arrays.

Lookup (if you know the index)

Look for an item in an array whose index is known. In other words, we can say it is how we access elements from the array.

Time Complexity = O(1)


Arrays — JavaScript (Made with Excalidraw)

Arrays or Lists are organized sequentially. They’re stored in contiguous memory. If you need to store some data and iterate over it, arrays are the best choice, especially if you know the indices.

Static & Dynamic Arrays

Static arrays are fixed in size. We need to specify the number of elements in the array while declaring it.

If we want to declare an array of groceries of 7 items, 7 consecutive addresses will be allocated in memory. If we realize later that we need to add one more item we will have to have dynamic arrays.

Dynamic arrays allow us to copy and rebuild…


Different Containers to Hold Different Things — Cupboard for clothes, Cabinet for Files, Book Case, Suitcase for packing items while travelling, and Fridge for Clothes.

In real life, we have containers for food (refrigerator), files (folders/file cabinets), toys (packing boxes), or clothes (cupboard). Each container is specific for a thing. We will not put files in packing boxes as they will crumble. It is a way for us to organize our things so we can go back and retrieve them easily.

Similarly, we put data in data structures and retrieve them from the data structures — that is all it is.

Just like in real life, there are tons of data structures in programming as well.

Introduction to Data Structure

A data structure is a collection of values, these…


Function Overloading in JavaScript (Made with Excalidraw)

Function Overloading In Programming Languages

Function overloading means creating multiple functions with different implementations. The rules in function overloading are

  1. The same function name is used for more than one function definition.
  2. The functions must differ by the types of their parameters.

Function Overloading in JavaScript

JavaScript does not support function overloading.

/**
* Display Name
* @param {string} name Name
*/
function displayName(name) {
return `Hi ${name}`;
}
/**
* Display Name
* @param {string} fName First Name
* @param {string} lName Last Name
* The above function will be overwritten by this function.
*/
function displayName(fName, lName) {
return `Hi ${fName} ${lName}`;
}
displayName('Ana'); // 'Hi Ana…


Ralph Waldo Emerson

This blog gives steps for adding local fonts to your React project.

Pre-requisite

@font-face

It is used to specify a custom font with which to display text; the font can be loaded from either a remote server or a locally-installed font on the user’s own computer.

Steps

  1. Create a fonts folder in the src folder of the React project.
  2. Add the local font files to the font folder. You can add all the font file formats.
  3. Define the custom fonts using @font-face in the main CSS file. This can be done as follows.

👉 Create a font.css file and put the properties…

Darshna Rekha

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