Aditya Chatterjee's Blog, page 145

November 17, 2021

Fruit into Baskets

In this article, we have explained how to solve Fruit into Baskets problem efficiently using the idea of Sliding Window.

Table of contents:

Problem statement: Fruit into BasketsSolution Approach
2.1. Naive Approach (Brute Force)
2.2. Optimized Solution (Sliding Window)
2.3. Pseudocode
2.4. Time and Space ComplexitySimilar Problems

Prerequisite: Sliding Window

This problem is similar to Leetcode problem 904. Fruit Into Baskets.

Problem statement: Fruit into Baskets

The fruit into baskets prob...

 •  0 comments  •  flag
Share on Twitter
Published on November 17, 2021 01:26

November 14, 2021

Load Testing, Spike Testing, and Stress Testing Web Servers with K6

In this article, we explore how we can use K6 to perform various kinds of testing on web servers specifically Load, Spike and Stress Testing Web Servers with K6.

Table of contents:

Introduction to K6Load Testing with K6Spike Testing with K6Stress Testing with K6Circumstances to consider when classifying the performance of your web server

Let us get started with Load Testing, Spike Testing, and Stress Testing Web Servers with K6.

Introduction to K6

K6 is an open source testing tool for maki...

 •  0 comments  •  flag
Share on Twitter
Published on November 14, 2021 08:00

Sigmoid Activation (logistic) in Neural Networks

In this article, we will understand What are Sigmoid Activation Functions? And What are it’s Advantages and Disadvantages?

Table of Contents:

IntroductionWhat are Activation FunctionsTypes of Activation FunctionWhat are Sigmoid Activation Function?What Is the Importance Of The Sigmoid Function In Neural Networks?Advantages of the Sigmoid FunctionDrawbacks of Sigmoid FunctionIntroduction:

The structure of a Neural Network is derived from the human brain. A Neural networks mimic the func...

 •  0 comments  •  flag
Share on Twitter
Published on November 14, 2021 07:38

November 13, 2021

Dot Product of Two Vectors in C++

In this article, we have presented two different ways to do Dot Product of Two Vectors in C++. This involves the use of inner_product method in C++ STL (Standard Template Library).

Table of contents:

Introduction to vector and dot productDot product in C++: Iterative methodDot product in C++: inner_product in STL

Prerequisite: Vector in C++ STL

Let us get started with Dot Product of Two Vectors in C++.

Introduction to vector and dot product

A vector quantity is a physical quantity that has b...

 •  0 comments  •  flag
Share on Twitter
Published on November 13, 2021 11:06

November 11, 2021

Modules in Rust

Let us explore a simple, yet very useful aspect of Rust.. Modules!

Table of contents

What are Modules?How to use ModulesExample!What are Modules?

Modules allow us to organize our code by separating similar functionality into their own groups for ease of readability and reuse, if need be! Modules also allow us to control the privacy of our code, by making things private or pub (public). Modules are part of the crate system of Rust, so they are very closely related.

How to use Modules

In our ...

 •  0 comments  •  flag
Share on Twitter
Published on November 11, 2021 11:40

4 Array Sum equal to Zero (4Sum II)

Reading time: 25 minutes | Coding time: 20 minutes

In this article, we have explored insightful approaches / algorithms to find elements in 4 arrays whose sum is equal to zero. This is an extension of 4 SUM PROBLEM.

CONTENTS OF THE ARTICLE:Pre-requisitesProblem Statement DefinitionSolution AnalysisMethod 1: Naive approachMethod 2: Applied Binary SearchMethod 3: Sorting and Two-pointer approachMethod 4: Extended two-pointer approachMethod 5: Hashing Based SolutionApplications

PRE-REQ...

 •  0 comments  •  flag
Share on Twitter
Published on November 11, 2021 08:44

Different ways to pause JavaScript code

In this article, we will see in detail the need to pause a running JavaScript code and what are the different ways in which one can achieve it like SetTimeout and async/await.

Table of contents

Why do we need to pause?Different waysSleepSetTimeoutasync/awaitWhy do we need to pause a running code?

Let us assume you made a web page and you want to fetch data in that web page from a diffrent resource and after fetching you want to display a message called "Thank you for visiting" , so in ...

 •  0 comments  •  flag
Share on Twitter
Published on November 11, 2021 02:54

Grid System in Bootstrap

Grid System in Bootstrap

The Bootstrap Grid System is used for layout, specifically responsive layouts. Understanding how it works is essential to understand Bootstrap. The grid is made from groupings of rows & columns inside one or more containers.

Table of contents:

Basics of Bootstrap GridContainerRows and ColumnsAll the things Bootstrap Columns can doHow to Responsive Design with Bootstrap?Key points on responsive design using the grid

Let us get started with Grid System in Bootstrap.

Basics of Bootstrap Grid...
 •  0 comments  •  flag
Share on Twitter
Published on November 11, 2021 02:27

November 10, 2021

"using namespace std;" is bad practice in C++

C++ is a very commonly used programming language which is used by many users who are active in "Competitive programming" and if they want to learn "Data structures and Algorithms" concepts and want to master in technical interviews for their dream job.

As C++ language is widely used nowadays but while writing its code you have to include some header files and a line "using namespace std;".But do you know including this particular line in a C++ code or a program is not considered a good practice?...

 •  0 comments  •  flag
Share on Twitter
Published on November 10, 2021 22:03

Different ways to terminate program in Java

Generally, Java programs terminate when they reach the end of the program, but there may be times when we need to know how to terminate a program when a certain condition is met or an exception occurs.

Table of contents:

Ways To Terminate Program in JavaThe exit() MethodReturn StatementThe Halt Method

Prerequisite: Basics of Java in one post

Let us get started with Different ways to terminate program in Java.

Ways To Terminate Program in Java

Terminating a program means to stop the executio...

 •  0 comments  •  flag
Share on Twitter
Published on November 10, 2021 21:18