Aditya Chatterjee's Blog, page 71

September 23, 2022

Improve your Python code speed

Python is one of those languages that provide a multitude of ways to do the same thing. This flexibility comes at a cost, the choices we make impact the prefomance of our code. Good programs strive to achieve balance between memory and time resources.

The impact might seem trivial for small programs but the impact becomes so evident when code complexity grows. In the receding paragraphs, I will point out ways to improve your python code.

All the code used in this article can be downloaded from t...

 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2022 19:36

Duff device in C++

In this article, we will discuss about duff device in C with help of example. This is an optimization technique related to Loop Unrolling.

Duff's device is a method for manually performing loop unrolling in the C or C programming languages that avoids the need for additional code to handle the remaining partial loop with help of do-while loop, and switch statement.
befor moving lets underatand what is loop unrolling?

Loop Unrolling

Loop unrolling is a technique in which reduce the number of ...

 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2022 19:33

RAII in C++

In this article, we will discuss RAII or Resource Acquisition Is Initialization approach in C++ with help of an example.

Table of Contents :

Introduction To RAIIIntroduction To ResourceRall class PropertiesExample With ExplanationImplementation of RAII in Standard LibraryApplication Of RAIIIntroduction To Smart PointerExample of smart pointerConclusionQuizIntroduction To RAII

In c++, RAII stands for " Resource Acquisition Is Initialization ". also known as "Scope-Bound Resource Mana...

 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2022 19:30

Graph and subgraph isomorphism

In this article, we will learn about graph and subgraph isomorphism and the algorithms to check for graph and subgraph isomorphism.

Table of contents:Graph isomorphismSubgraph isomorphismSubgraph isomorphism algorithmsApplications

Graph isomorphism:
Given two simple graphs G and H we can say G and H are isomorphic if there is a one to one correspondence between the vertices and the edges, this means G and H are equivalent in terms of structure.

Conditions for two graphs to be isomorphic:

...
 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2022 19:28

Culture Fit interview for Data Science job [Mock]

In this article, we will get to know the flow of a culture fit interview for a Data Science job and some pointers on how you could answer the questions asked.

A culture fit interview is to determine if you share your values with the company and how compatible you are with the way the company works. This takes place after the technical round. When you have the required skills to fill the position and you have a top notch resume, the final step (mostly) before hiring you is the culture fit intervi...

 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2022 15:19

Lagrange’s Four Squares Theorem

In this article, we will discus Lagrange’s four square theorem in detail with examples and an algorithm to verify it.

Table of contents:

What is a Natural Number?Did You Know?ProofAlgorithmTime complexityReal Life applicationsQuestion

Before we delve into the details. Here are some interesting mathamatical facts you might not have known which will help you understand Lagrange’s Four Squares Theorem better.

What is a Natural Number?
Natural numbers are positive integers (whole numbers) su...

 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2022 13:29

Mersenne prime numbers

When 2^n -1 is prime, it is said to be a Mersenne prime. In this article, we have explored this concept of Mersenne prime numbers in depth along with algorithms + implementations to find Mersenne prime numbers.

Table of contentsDefinitionsAlgorithmTime complexityA way of implementationThe Lucas-Lehmer Test1. Definitions

A prime number is a number that is only divisible to 1 and itself.

The first few primes are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 …

Notice that 1 is not part of thi...

 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2022 13:24

September 22, 2022

Gradient Ascent

We shall be discussing Gradient Ascent.

Table of Contents:

Gradient Ascent (Concept Explanation)Application of Gradient AscentDifferences with Gradient DescentGradient Ascent (Concept Explanation)

Gradient Ascent as a concept transcends machine learning. It is the reverse of Gradient Descent, another common concept used in machine learning. Gradient Ascent (resp. Descent) is an iterative optimization algorithm used for finding a local maximum (resp. minimum) of a function. Taking repeated ...

 •  0 comments  •  flag
Share on Twitter
Published on September 22, 2022 19:37

September 20, 2022

BERT Interview Questions (NLP)

In this article, we will go over various questions that cover the fundamentals and inner workings of the BERT model.

1. Briefly explain what the BERT model is.

Answer: BERT, which stands for Bidirectional Encoder Representations from Transformers, is a language representation model that aims at tackling various NLP tasks, such as question answering, language inference, and text summarization.

2. How is the BERT model different from other language representation models?

Answer: The BERT model pre...

 •  0 comments  •  flag
Share on Twitter
Published on September 20, 2022 13:27

September 19, 2022

SVG in HTML

In this article, we will learn about the SVG tag in HTML.

Introduction to SVG SVG in HTML Why SVG? Shapes in SVG Text in SVGIntroduction to SVG:SVG stands for Scalable Vector Graphics and it is one of the modern ways of displaying images in websites and applications just like displaying PNG, GIF, and JPG.In SVG, the shapes are specified in XML. The XML is then rendered by an SVG viewer.Every element and every attribute in SVG files can be animated. SVG is a W3C(World W...
 •  0 comments  •  flag
Share on Twitter
Published on September 19, 2022 11:27