# Data Structure

A Data Structure is a storage that is used to store and organized data.

## Height of a Binary Tree

This tutorial explains the Height of the Binary Tree with some examples. In the following example there is a B Tree given, We have to find the Height of The Tree. What is the Height of The Binary Tree? The Height of a Tree Is equal to the largest numbers of edges from the Root …

## Binary Tree Data Structure With Examples

A Binary Tree is defined as a Tree Data Structure where each node (left and right ) has only 2 children. Since each element in a Tree can have only 2 children, we typically named them left and right child. Binary Tree Representation A Binary Tree is represented by the topmost Node (Commonly known as …

## Binary Tree Insertion With Example

In this tutorial we will perform an operation of Insertion of Node in Binary Tree. With some examples we will learn about it. Complete Example To Insert A Node in B Tree In the below example first we created a Tree then printing it using the Preorder Traversal then inserting a node in the existing …

## Binary Tree Traversal Data Structure

In this tutorial we will learn how to Traverse a Binary Tree in different Traversal modes ways with some examples. What is Binary Tree Traversal? We get the values or elements of Binary Tree by Traversing it. Often we wish to process a binary tree “by visiting each of its nodes”. Mode of Binary Tree …

## What is Recursion?

In this tutorial we will learn What is Recursion and how to use it with some examples. Recursion is a widely used phenomenon in computer science used to solve complex problems by breaking them down into simpler ones. It is the process by which a function calls itself directly or indirectly. The corresponding function is …

## Best Time to Buy and Sell Stock

In this tutorial we will learn how to deduct Best Time to Buy And Sell Stock To Get maximum profit. Below are some examples. This problem can be solved by various approaches. Problem? Given an array of N length, representing the process of the stocks on different days. The task is to find the maximum …

## Remove Duplicates From An Array In JavaScript

There are various methods to Remove Duplicates from An Array in JavaScript. We will discuss the most common methods from them. What are Duplicates in An Array? Duplicate values are those values which are presented more than one time in the array. So in this tutorial we will remove those duplicate values from the array …

## Factorial of a Number

Factorial for a non-negative integer or number is the multiplication of all positive integers less than or equal to the value. For example factorial for a 5 is 5x4x3x2x1 = 120. This is a part of Data Structure. The above calculation is achieve by the formula of ‘n!’ which can be represent as below. This …

## Spiral Matrix With Examples

In this tutorial we will learn how to Spiral A Matrix with examples. In other words Spirally Traverse of a Matrix using best approach of algorithm. This is a part of Data Structure. How To Spiral A Matrix? We have a input Matrix as shown above. It could have any length. Now we have to …

## Trapping Rain Water Problem In JavaScript

In this tutorial we will learn about Rain Water Trapping Problem with some examples. This is a part of Data Structure. What is Rain Water Trapping Problem in Data Structure? In simple way, we have many building placed left and right to each other. All buildings have different heights as shown in above image.We have …

## Find Maximum Product Subarray Using JavaScript

In this tutorial we will learn how to Find Maximum Product Subarray from an integer of array. The maximum product subarray is the part or an array which have maximum value of multiplying the subarray elements. What is Maximum Product Subarray Problem? Given an array that contains both positive or negative integers. Find the product …

## Kadane’s Algorithm In JavaScript With Example

In this tutorial we will learn about Kadane’s Algorithm with examples in JavaScript. What is Kadane’s Algorithm? It is an iterative dynamic programming algorithm. It calculated the maximum sum subarray ending at a particular position by using the maximum sum subarray ending at the previous position. In this tutorial we learn using JavaScript. Kadane Algorithm …

## JavaScript Array Filter With some examples

In this tutorial we will learn about Filter An Array In JavaScript with some examples. Array is an important part of any programming language which is mostly used to manipulate the data. An array contains iterable data which can be iterate using loop. How To Search Data in An Array or Objects of Array In …

## Includes Method in JavaScript With Example

In this tutorial we will learn about includes() function in JavaScript. How to Use includes() Function in JavaScript? Generally it compares two string and returns true if string contains the specific string otherwise it returns false. It also returns true if some of part completely matches the string. => includes(value, position) We can also provide …

## Sorting An Array In JavaScript

In this tutorial we will learn , How to sort different types of array in JavaScript. Generally sorting needed in table’s column. On clicking the column name it sorted by ascending or descending order. We will sort a string array, integer array and objective array with examples. How to sort an array in JavaScript? 1. …