Aditya Chatterjee's Blog, page 63

December 11, 2022

Determine index from pointers in C++

Well I encountered this problem when I was practicing my DSA, so here I will share how its stored in my mind. In this article, we will look at how to compute the index using pointers returned by STL functions. It will be explained in such a way that even a 4th grader would get it.

Table of contents

IntroductionProblem statementReason for this behaviorHow to solve this issue?
4.1 Solution 1 (Subtracting the starting iterator)
4.2 Solution 2 (Using std::distance())Implementing the solutionsT...
 •  0 comments  •  flag
Share on Twitter
Published on December 11, 2022 07:21

Penporn Koanantakool

Penporn Koanantakool is a Senior Software Engineer at Google and is best known as TensorFlow contributor and for reviewing pull requests for TensorFlow.

Best known for:

Reviewing TensorFlow pull requestsNamePenporn KoanantakoolProfessionProgrammer, Computer ScienceCompanyGoogleKnown forContributions to TensorFlowFieldsDeep LearningBirth placeThailandBorn1989LocatedUSAEducationPhD in Computer Science from UC Berkeley in 2017BE from Kasetsart University 2010Citations452h-index8...
 •  0 comments  •  flag
Share on Twitter
Published on December 11, 2022 02:32

December 7, 2022

Getting started with Data Science

Getting started with Data Science

Every day in this world data is generating at the rate of 2.5 quintillion (2,500,000,000,000 millions) bytes per second. The field of Data Science tries to explore the insights we can gather from the data how can we predict the future or how one organization can improve its efficiency by acting on that data. Data Science inspects many techniques through which we gather data, clean it, transform it, gain insights and even predict future outcomes. It is one of the most recommended job of the centu...

 •  0 comments  •  flag
Share on Twitter
Published on December 07, 2022 08:55

Negative Index in Python

IntroductionNegative Index in Python

In this article, I shall be explaining negative indexes in Python. But first, we have to know these prerequisites: iterables and indexing. Having a fair knowledge on these two are paramount to understanding how negative indexes works.
So we shall be looking at the following:

IterableIndexingNegative indexesPictorial illustration of negative indexesCode examples of the use of neagtive index in a list iterableBenefits of negative indexes



Iterable

An iterable is an object that ...

 •  0 comments  •  flag
Share on Twitter
Published on December 07, 2022 08:46

December 5, 2022

typedef struct in C [Explained]

In this article, we have explored the concept of typedef struct in C Programming Language which brings in two core concepts. We have explained the ideas with code examples and differences between typedef struct and struct.

In C language struct is a great way to group several related variables of different data type all at one place. typdef is yet another way used for declaring the type of structure in C language.

More so the fact that, typedef gives freedom to the users by allowing them to creat...

 •  0 comments  •  flag
Share on Twitter
Published on December 05, 2022 13:23

Different Ways to Convert Vector to List in C++ STL (7 ways)

Reading time: 20 minutes | Coding time: 15 minutes

In this article, we have explored 7 different methods to convert vector to list in C++ Programming Language.

Table of contentIntroduction to vector and listDifferent methods of converting vector to arraysTheir implementations

Prerequisite: Vector in C++ STL , List in C++ STL

Vector

Vectors are sequence containers representing C-style dynamic arrays that can change its size dynamically. Sequence containers store elements strictly in linea...

 •  0 comments  •  flag
Share on Twitter
Published on December 05, 2022 07:44

December 4, 2022

System Design of Facebook Messenger

In this article, we have explained the System Design of Facebook Messenger in depth along with estimation of requirements and class diagram.

Understanding the problem(Messenger) System Requirements Estimation of Requirements Data flow High Level Component Design Detailed Design Identify and Resolve Bottlenecks
Understanding the problem(Facebook Messenger)

Facebook Messenger is a software application that provides instant messaging services to its users. Users can ...

 •  0 comments  •  flag
Share on Twitter
Published on December 04, 2022 07:03

November 30, 2022

Payment Gateway System Design

In this article, we have explored the System Design of a scalable Payment Gateway such as PayPal and Stripe. We have presented functional, non-functional requirements, use case diagrams and much more.

payment_gateway

Table of Contents

What is a payment gatewayRole of a payment gatewayFunctional and Non functional requirementsUse case diagramsImplementationExamples of payment gatewaysWhat is a payment gateway?

A payment gateway is a technology that allows merchants recieve online (card not present) cred...

 •  0 comments  •  flag
Share on Twitter
Published on November 30, 2022 13:29

Perlin Noise (with implementation in Python)

Introduction

One of the most important algorithms in computer graphics and procedural generation is Perlin Noise. Perlin Noise is an algorithm that generates textures and terrain-like images procedurally (without the need for an artist to manually create the images). Ken Perlin is the creator of this algorithm, for which he also won an Academy Award in 1997.

What is a noise function?

There are numerous natural objects in the environment, like mountains, clouds, terrains, etc. that have some rand...

 •  0 comments  •  flag
Share on Twitter
Published on November 30, 2022 04:18

November 28, 2022

Corporate Flight Bookings problem [Solved]

In this article, we will solve Corporate Flight Bookings problem using prefix sum algorithm. In naive approach, it will take a quadratic O(N^2) time complexity but using a prefix sum approach we can get better time complexity.

Table of contents:

Problem StatementApproach 1: Naive methodApproach 2: Prefix sum approachProblem Statement

The Corporate Flight Bookings problem is a problem of finding the total seats reserved for each n flights. we are given i length bookings array which contains ...

 •  0 comments  •  flag
Share on Twitter
Published on November 28, 2022 00:30