Aditya Chatterjee's Blog, page 194
September 19, 2020
Chrome Dinosaur (T-Rex
We all have played the t-rex game on chrome! Its time to make our own now.
We will be using Processing for the same, and you may install it at https://processing.org/download/.
You may start with opening Processing, and naming your sketch as tRexGame.
Make sure you have opened it in Java mode. 
Our game consists of the following entities,
The player (the T-rex)
The Obstructions
We may create 2 more files (tabs in the processing window) for the above entities. These are actually .pde files.
E...
September 9, 2020
Main points on BASH (Bourne-Again SHell)
BASH was developed by GNU Project.
BASH is backward compatible with sh shell.
BASH has also incorporated various features from C Shell as well as Korn Shell.
BASH Files
/etc/profile : It is a systemwide initialization file which is executed when using login shells.
/etc/bash.bashrc : It is systemwide BASH startup file. Runs when we start BASH for the the first time in our system after turning it on.
/etc/bash.logout : It is systemwide BASH cle...
September 7, 2020
String Pool in Java
In this article, I have explained the String Pool in Java and how to implement it in Java programming. I have covered basic concepts of this topic.Also, I have explain the diagram.
First of all we should know about String. So String is a special class in java and we can create String object using new operator as well as providing values in double quotes.
For example, "opengenus" and "Hello everyone" are both strings
String Pool in a Java is a storage area in Java heap(area of memory used for ru...
September 5, 2020
Multinomial Naive Bayes
Multimodal naive bayes is a specialized version of naive bayes designed to handle text documents using word counts as it's underlying method of calculating probability. Before diving into what multinomial naive bayes is, it's vital to understand the basics.
Basics
Assumption: Each feature has these properties
For instance, a feature could be a word
Are independent
Are equal
Bayes Theorem: P(A|B) = (P(B|A) * P(A)) / P(B)
This is a probabilistic equation that infers a probability from previous ...
Byte Pair Encoding for Natural Language Processing (NLP)
Byte Pair Encoding is originally a compression algorithm that was adapted for NLP usage.
One of the important steps of NLP is determining the vocabulary.
There are different ways to model the vocabularly such as using an N-gram model, a closed vocabularly, bag of words, and etc. However, these methods are either very computationally memory heavy (usually paired with a large vocabularly size), do not handle OOV (out-of-vocabulary) words very well, or run into issues with words that rarely appear....
Travelling Salesman Problem (Bitmasking and Dynamic Programming)
In this article we will start our discussion by understanding the problem statement of The Travelling Salesman Problem perfectly and then go through the basic understanding of bit masking and dynamic programming.
What is the problem statement ?
Travelling Salesman Problem is based on a real life scenario, where a salesman from a company has to start from his own city and visit all the assigned cities exactly once and return to his home till the end of the day. The exact problem statement goes li...
Travelling Salesman Problem (Basics + Brute force approach)
In this article we will start our discussion by understanding the problem statement of The Travelling Salesman Problem perfectly and then go through the naive bruteforce approach for solving the problem using a mathematical concept known as "permutation"
What is the problem statement ?
Travelling Salesman Problem is based on a real life scenario, where a salesman from a company has to start from his own city and visit all the assigned cities exactly once and return to his home till the end of th...
August 31, 2020
script and scriptreplay in linux

script and scriptreplay are pre-installed commands in Linux. They are more like the utilities which allow the user to record their terminal session and to refer to it anytime he/she needs it. It is a command-line utility, so can run any Linux machine.
script Command
Script commad helps us to record everything printed on the terminal to a dedicated log-file. After executing the command everything present on the terminal will be recorded, be it the typing of commands or the output. When a dedicate...
Cycle Detection Algorithms
As we have already seen various algorithms to detect a cycle in a linked list. In this article we are going to explore some more cycle detection algorithms in general.
A cycle in a data structure as we have already seen is a condition with no end.
Here are a few popular cycle detection algorithms:
Floyd's cycle detection algorithm
Brent’s Cycle Detection Algorithm
Both of these algorithms are used to find the cycle in a linked list.Both of the algorithms use the slow and fast pointer approach ...
Finding the length of a loop in linked list
In this article we will look at the method of finding the length of a loop in a linked list.For that you should be able to understand the floyd's loop detection algorithm.
Here is a picture that shows the cycle/loop in a linked list with a length of 4.
Before we move forward with the length of cycle in a linked list, let's look at the floyd's cycle finding algorithm.
floyd's cycle finding algorithm
Here is the working of the algorithm.
A slow and a fast pointer is used.
Slow pointer moves by o...


