Aditya Chatterjee's Blog, page 208
May 23, 2020
Linear Search in C Programming Language
We have explored Linear Search algorithm and implemented variants of Linear Search in C Programming Language. The variants we have explored are:
Linear Search in array in C
Linear Search in Linked List in C
Linear Search in array with duplicates in C
Linear Search in Linked List with duplicates in C
Linear Search is a sequential search algorithm to find the position of a key in a given list of elements by traversing every element in the list until a match is found.
Though Linear search is the...
May 22, 2020
Techniques for Time Series Prediction

In Basics of Time series prediction, We talked about time series where we covered time series data, common patterns in time series data, training ,test and validation sets and statistical forecasting on time series data. We got pretty good results using statistical forecasting on the time series data(mean absolute error = 4.5).
The techniques for Time series prediction are:
Time Series Forecasting Using Artificial Neural Networks
Single Layer Neural Network
Recurrent Neural Networks
Long Shor...
Implement Memory Efficient Applications in Node.JS
Node.JS provides us with great APIs, modules, etc. for optimizing the code that is being run on Random Access Memory (RAM). With the help of the inbuilt tools provided by Node, we can change the way how our software runs in a system. Our software applications usually runs in a system's Primary memory i.e. Random Access Memory (RAM).
Node.JS allows us to write small to large sized applications and projects including Databases. Dealing with the software's efficiency and memory is always a challen...
May 21, 2020
An Introduction to Recommendation System
We are seeing an unprecedented rise in the use of the recommendation system in various services. Be it Youtube, Amazon, Netflix, advertisement, or an e-commerce site, these systems are unavoidable in our online journey. They aim to predict users' interests and suggest products that they might like according to their interests. Machine Learning approaches are common in Recommendation System.
Why do we need recommendation system?
They give users a lot of options which he or she might not have eve...
String Matching using Bitset
In this article, we have explored how to solve string matching problem (find all occurences of string S1 in another string S2) using Bitset. It is a modification of the naive approach which takes O(L x P x logL) time complexity and assumes all positions to be potential matches and eliminates them based on previous comparisons. The modification with bitset improves the time complexity to O(L x P / K) where L is length of string S2, P is length of string S1 and K is register size.
Bitset
Bitset i...
Designing Complex Numbers using Classes in Python
In a previous article, we talked about complex numbers in Python using built-in classes and attributes to perform operations on them. But, imagine if Python didn't come equipped with these conveniences. How would we go about implementing complex operations? We can explore that concept by utilizing built-in mathematical operations to create our own complex class in Python.
To start off, we need to initialize our complex number:
def __init__ (self, real, imag=0.0):
'''Form complex number'''
...
May 20, 2020
Sorting a 2 Dimensional (2D) vector in C++
Vectors are data structures similar to array but with features such as dynamic memory, resizable container, insertion and deletion of elements. Vector elements are places in contiguous storage so that they can be accessed and traversed using iterators. A 2D vector is vector of vectors. It is an matrix implemented with the help of vectors.
In this article, we will explore different ways to sort a 2 dimensional (2D) vector in C++ which includes sorting by row, column, a specific row or a specific...
Solving Linear Programming problems in Python using cvxpy library
Mathematical Programming is used to find the best or optimal solution to a problem that requires a decision or set of decisions about how best to use a set of limited resources to achieve a state goal of objectives.
Linear programming requires that all the mathematical functions in the model be linear functions. We have solved linear programming problems in Python using cvxpy library.
Learn how to formulate Linear Programming problems
Mathematical formulation
Decision variables: X1, X2, X3, ....
How to formulate a linear programming problem?
In this article, we will explore into sample problems and formulate it as a linear programming problem. We have considered three problems:
Product Mix Problem
Transportation Problem
Flow Capacity Problem
Before we look into linear programming, let us have a quick look at Mathematical progamming, which is a superset of linear programming.
Mathematical Programming
Mathematical Programming is used to find the best solution to a problem that requires a set of decisions about how to best use a set...
May 19, 2020
Handling Exceptions in Java
In some cases, it might happen that the method that you are calling goes wrong or generates an exception. An exception is an undesirable or unforeseen occasion, which happens during the execution of a program and disturbs the typical progression of the program's guidelines. Exception Handling is a way to deal with this possibility.
An exception is an object of type Exception. The process of creating such an object and handing it to the runtime system is known as "throwing" an exception....