Aditya Chatterjee's Blog, page 200

June 24, 2020

John McCarthy, Man behind Garbage Collection

John McCarthy, Man behind Garbage Collection

John McCarthy was one of the most influential Computer Scientists in 1950s and a Professor at Stanford University for nearly 38 years. He is best known for:



Developed LISP Programming Language
Inventing Garbage Collection (which is widely used and popularized by Java)
Inventing the word "Artificial Intelligence" (AI) and is one of the founding members of the domain
First person to propose the idea of Utility/ Cloud Computing publically
Contributed greatly to ALGOL Programming Language

John McCarthy, Man behind Garbage Collection


John M...
 •  0 comments  •  flag
Share on Twitter
Published on June 24, 2020 07:42

June 23, 2020

Cin and Cout in C++

Reading time: 30 minutes | Coding time: 10 minutes


C++ uses the concept of streams to perform I/O operations. A stream is a sequence of bytes in which character sequences are 'flown into' or 'flow out of'. Streams operate as the intermediate between the program and the I/O devices thus helping the programmers to achieve device independent I/O operations. The two types of streams in C++ are:



input stream
output stream

IOstreams-1


Headerfiles available in C++ for Input/Output Operations :



iostream - ios...
 •  0 comments  •  flag
Share on Twitter
Published on June 23, 2020 03:16

Advantages and Disadvantages of Logistic Regression

Reading time: 25 minutes


Logistic Regression is one of the supervised Machine Learning algorithms used for classification i.e. to predict discrete valued outcome. It is a statistical approach that is used to predict the outcome of a dependent variable based on observations given in the training set.


Advantages


Logistic Regression is one of the simplest machine learning algorithms and is easy to implement yet provides great training efficiency in some cases. Also due to these reasons, training...

 •  0 comments  •  flag
Share on Twitter
Published on June 23, 2020 02:23

June 22, 2020

Gale Shapley Algorithm for Stable Matching problem

Reading time: 30 minutes | Coding time: 10 minutes


Gale Shapley Algorithm is an efficient algorithm that is used to solve the Stable Matching problem. It takes O(N^2) time complexity where N is the number of people involved.


images


Stable Matching problem
Introduction

We have 2 sets of people:



The first set contains females
The second set contains males.

Each person in each set has a list of preferences which includes all the people from the opposite set. That is, every woman in the set has a pref...

1 like ·   •  0 comments  •  flag
Share on Twitter
Published on June 22, 2020 15:32

Minimum Increment and Decrement operations to make array elements equal

Reading time: 30 minutes | Coding time: 10 minutes


We are given an array, we need to find the minimum number of increment and decrement operations (by 1) required to make all the array elements equal.


Let us understand this problem with the help of an example:


We need to make the elements of this array equal : arr [] = {2,4,5,7,10}.


It is important to note here, that though we can make the array elements equal to any number in the array but we are asked to find out the minimum number of operati...

 •  0 comments  •  flag
Share on Twitter
Published on June 22, 2020 14:46

Minimum number of increment (by 1) operations to make elements of an array unique

Reading time: 35 minutes | Coding time: 10 minutes


We are given a sorted array (if not, then sort it using any sorting algorithm or built in functions) which might have duplicate elements, our task is to find the minimum number of increment (by 1) operations needed to make the elements of an array unique.


Example : Consider a sorted array - x [1,2,4,4,4,5].

i=0 : x[i] = 1 (Unique)

i=1 : x[i] = 2 (Unique)

i=2 : x[i] = 4 (Unique)

i=3 : x[i] = 4 (increment once to get 5) => res = 1

i=4 : x[i] = 4...

 •  0 comments  •  flag
Share on Twitter
Published on June 22, 2020 11:47

Command Pattern in Java

Reading time: 15 minutes


The command pattern is a behavioral-based design pattern that encapsulates a request/action in an object without knowing the internal operations.


The idea is to create an interface of commands as objects that can be called while being able to decouple the object that performs the action and the object that invokes the action. We have explored it in Java.


Problem

Take for instance, the typical programs we wrote when we coded our first programs. Often times we would use a...

 •  0 comments  •  flag
Share on Twitter
Published on June 22, 2020 11:04

June 21, 2020

Build a Static Website using Gatsby

[image error]

[image error]

The world of web developement is constantly changing as different JavaScript Frameworks and Tools provide different approaches to web development. But large number of websites on the internet are simple informative sites like marketing sites and blogs which don't require much complex structure.In such scenarios static websites generators like Gatsby, Hugo and Jekyll comes in the picture.


In this article, we are going to build a static website using Gatsby. Gatsby is React based, GraphQL powere...

 •  0 comments  •  flag
Share on Twitter
Published on June 21, 2020 14:32

June 20, 2020

Trigonometric Functions using in C

The math.h header defines various mathematical functions including trigonometric and hyperbolic functions. All the these predefined trigonometric functions use radians as argument. We have explored all Trigonometric Functions using in C.


So what's the deal with radians?


There are two forms of measurement for the the arc of a circle:



Degrees
Radians

for example: 180° is equal π rad - a half of the circle (180°= π)


CONVERSION OF DEGREES TO RADIANS

one degree equals 0.01745329 radians


#include ...
 •  0 comments  •  flag
Share on Twitter
Published on June 20, 2020 14:48

Native Language Identification (NLI)

By definition, Native language identification (NLI) is the task of determining an author's native language based only on their writings or speeches in a second language. This is an application of Machine Learning. Let us break this down to know what this actually means.


English is a language which is widely used throughout the word. But not all of them who write or speak english are native language speakers. This means that whenever anybody who is not a native english speaker writes or speaks i...

 •  0 comments  •  flag
Share on Twitter
Published on June 20, 2020 00:55