Aditya Chatterjee's Blog, page 68

October 22, 2022

Implement std::function in C++

First, I introduce you to the std::function and then proceed to the implementation

Class template std::function is a general-purpose polymorphic function wrapper. Instances of std::function can store, copy, and invoke any CopyConstructible Callable target:

functionslambda expressionsbind expressionspointers to member functionspointers to data members.or other function objects

std::function is introduced in C++ 17
The stored callable object is called the target of std::function. If a std::...

 •  0 comments  •  flag
Share on Twitter
Published on October 22, 2022 13:46

Two pointer technique in JavaScript

Two pointer technique in JavaScript

Introduction

The two pointer technique is one of the tools to solve competitive programming and to solve technical interviews. We have explained how to use it in JavaScript.

The pattern in two pointer is that by processing two elements over a single loop we can improve the time and space complexity. That is why it is more efficient than the naive approach( Brute force approach ) which processes a single element per loop.

we can apply this approach either on arrays or linked list to find sub elem...

 •  0 comments  •  flag
Share on Twitter
Published on October 22, 2022 02:29

October 21, 2022

Array of Vectors in C++ STL

Array of Vectors in C++ STL

In this article, we will learn about Array of Vectors in C++ STL with C++ code snippets. Before getting started with array of vectors we should know about the arrays and vectors in C++.

Array:-

An array is a collection of elements of the same datatype and these elements are stored in contiguous memory locations.We cannot change the size of array once we have declared it.

Creating an Array:
The syntax for declaring an array is:

data_type array_name[array_size];

For example:

int marks[10]; //mark...
 •  0 comments  •  flag
Share on Twitter
Published on October 21, 2022 10:16

Different ways to convert vector to map in C++

In this article, we will develop an approach to find different ways to convert vector to map in C++.

Table of contents::what is map?what is vector?Implementation of map to vectorDifferent ways to convert vector to map in C++Implementation Using std::copyImplementation Using copy constructorImplementation Using std::transformApplicationsQuestion

First we need to know what are Vectors and Map

Maps are a part of the C++ Standard Template Library
maps are used to replicate associative ar...

 •  0 comments  •  flag
Share on Twitter
Published on October 21, 2022 10:11

October 17, 2022

Maximum sum leaf to root path

In this article, I will be discussing about Maximum sum leaf to root path in Binary tree along with time and space complexity.

Contents:

IntroductionProblem ApproachImplementationTime and Space Complexity AnalysisIntroduction:

Suppose we are Given a Binary Tree, and we have to find the maximum sum path from a leaf to root. For example, in the following tree, there are three leaf to root paths 8->-2->10, 9->-2->10 and 3->10. The sums of these three paths are 16, 17 and 13 respectively.
tree1
The...

 •  0 comments  •  flag
Share on Twitter
Published on October 17, 2022 08:53

ReLU6 in ML

What's an activation function?

When using machine learning, activation functions are used to transform weighted input from a node to an output value that is passed on to either another layer or can be used as the final output. If we neglected using these, we would simply see linear regression.

A good comparison is thinking about how the brain works. A neuron will get many input signals and its 'activation function' will determine its importance. This activation function would determine whether o...

 •  0 comments  •  flag
Share on Twitter
Published on October 17, 2022 08:43

Life of a freshman year in college

Introduction

First year! I am sure no one forgets it. A freshman is full of enthusiasm as well as confused, especially, friends, seniors, late night fun become large part of their lives.

Dawn days

Entering college campus brings whole new vibe. For the first time everybody is out of their nest. Fighting through homesickness, academic challenges, struggling to make good friends and life. It is when everyone starts fresh. Most people try to fit in and impress the others, having crushes around when ...

 •  0 comments  •  flag
Share on Twitter
Published on October 17, 2022 05:14

October 16, 2022

Bus Error in C++

In this article, we will be discussing about "Bus Error In C " and SIGBUS signal in detail.

Contents:

Introduction to Bus ErrorMain causes of Bus ErrorsNon-existent addressUnaligned accessPaging errorsProgram CodeExplanationQuizIntroduction

When a process attempts to access memory that the CPU cannot physically address, hardware will raise an error to alert the operating system which is known as a bus error.

The bus error also known as SIGBUS is typically signal 10. The acronym SIGBUS...

 •  0 comments  •  flag
Share on Twitter
Published on October 16, 2022 08:45

October 12, 2022

Three - Dimensional 3D ArrayList in Java

arrayList

In this article, we have explored the concept of 3D ArrayList in Java and demonstrated how to perform different operations such as insert, delete, search and much more with Java code snippets.

Why do we need arrays?

Suppose you want to store five integer numbers. What will you do? You will create five different variables and store interger numbers in them. Now let's say you want to store 10000 integer numbers. Is it feasible to create 10000 variables for this? Not at all! To handle these situat...

 •  0 comments  •  flag
Share on Twitter
Published on October 12, 2022 14:47

October 10, 2022

Radial Basis Function Neural Network

Radial Basis Function Neural Network (RBFNN) is one of the shallow yet very effective neural networks. It is widely used in Power Restoration Systems.

In this article we will discuss the following points:

What is an RBFNN ?Radial Basis FunctionTraining an RBFNNSolving the XOR problem using RBFNNSimilarities and differences with MLPsConclusion1. What is an RBFNN ?

An RBFNN is a feed-forward neural network, composed from : an input layer representing the source of data, e...

 •  0 comments  •  flag
Share on Twitter
Published on October 10, 2022 09:44