Aditya Chatterjee's Blog, page 195
August 29, 2020
Smart and Safe Cab Finder Algorithm
Smart and Safe Cab Finder Algorithm is used to locate the nearest and safest cab for passengers using specific designed algorithm. This algorithm is designed to give most safe riding suggestions of all the cabs available in the vicinity.
The algorithms also considers the factors such as:-
1. Number of rides the person has got in that day.
2. Rating of the driver.
3. Distance of the cab from the location of passenger pick up point.
Working of the Algorithm:-
The co-ordinates of the taxis are sto...
Struct pointer in C
In this article, we will learn about the structure pointers , in C/C++ we have a feature to use pointers with Structure. Like pointers to other data types we can use pointer to structure.
What are Structures?
Structures are a group of variables declared under one single name . It is done when we have a similar characteristics of the entities.
Like details of a student reading in coaching centre .Each of the student will be having a first name, last name, Date of birth, Sex , Contact Number , Add...
Typedef function pointer in C
The keyword typedef is used to define new data type names in C/C . Here we should not not mistaken that we are creating any new data type, we should carefully note that we are just giving new names to the data types already available to us by C/C .
It really helps in writing codes which are more close to the machine because instead of writing long repeated lines. We can just use typedef and rest other will be done by the compiler.
It should be noted it is job of the compiler to do all the nece...
August 28, 2020
Minimum Bitwise OR operations to make any two array elements equal
Given an array of integers and an integer K, we can perform the Bitwise OR operation between K and elements of the array any number of times.
We have to count minimum number of such operations that are required to make any two elements of the array equal. If, even after performing such operations, it is not possible to make any two elements of the array equal, then print "Not Possible".
Examples:
Example Input 1:
K = 4
n = 5
arr = [1, 1, 2, 2, 3]
Example Output 1:
Minimum Operations are: 0
(Sinc...
August 26, 2020
MiniMax Algorithm: How Machine thinks?
Reading time: 30 minutes | Coding time: 20 minutes
Have you ever wondered how computers make its move in chess, tic-tac-toe, or any other multiplayer strategic board game? Well! That's what we are going to look into this lesson precisely. This article will focus on the most popular decision-making strategy algorithms appointed by programmers in various strategic games. The name of the algorithms is the Minimax Algorithm, which is one of the many game theory algorithms in computer science.
Befo...
August 25, 2020
Pancake Sort Algorithm (in-place, not stable)
Reading time: 30 minutes | Coding time: 15 minutes
Pancake sort is a sorting algorithm in which the only allowed operation is to "flip" one end of the list. It is inplace but not stable.
Pancake sort is called so because it resembles sorting pancakes on a plate with a spatula, where you can only use the spatula to flip some of the top pancakes in the plate.
Unlike traditional sorting algorithms, which attempt to sort with the fewest comparisons, pancake sort tries to sort the sequence in as few...
Transformer Networks: How They Can Replace GANs

Today we cover Transformer Networks. These are all the rage nowadays in the machine learning world, especially in fields like Natural Language Processing where they have broken numerous records. Some of the most famous transformer networks are BERT and GPT, and you must have seen these abbreviations somewhere.
This post is a follow up to a previous post that introduced us to Generative Adversarial Networks (GANs), so do check that out first. After an introduction to how transformers work, and a...
August 23, 2020
Exploring the CodeForces API
In this article, we will explore the Codeforces API. With codeforces API, one can get access to limited data from in machine-readable JSON format.
What is API?
API stands for Application Programming Interface. An API is a set of routines, protocols, and tools for building software applications. It is a software piece that can be used by another piece of software to allow applications to talk to each other.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight data-interchange format....
Types of Load Balancing Algorithms

In the previous article, we got an insight into the load balancer, what is a load balancer, how it works,different types of load balancer, and the companies which provide the load balancer.
If you haven't read that article
You can check it here : - Load Balancer
In this article, we will delve into the different types of load balancing algorithms. The different types of Load Balancing algorithms are:
Round-Robin
Weighted Round Robin
Least Connections
Hashing Methods
URL Hash Method
Source IP Ha...
August 19, 2020
Different Self Balancing Binary Trees

A self-balancing binary tree is any tree that automatically keeps its height small in the face of arbitrary insertions and deletions on the tree. The height is usually maintained in the order of log n so that all operations performed on that tree take O(log n) time on an average. Now let us look at the most widely used self balancing binary trees, their complexities and their use cases. The various self balancing binary search trees are:
2-3 tree
Red-Black Tree
AVL tree
B tree
AA tree
Scapegoa...