Aditya Chatterjee's Blog, page 98
April 11, 2022
copy and swap idiom in C++
In this article, we have explained copy and swap idiom in C++.
Table of contentsWhat is the copy-and-swap idiom?A way of implementation1. What is the copy-and-swap idiom?The simple answer that can explain this idiom is by saying is a way of implementing the assignment operator in terms of a swap function.
And it all started with the copying of pointer members of a class.
Let's look at the next class definition
#include using namespace std;class A { public: int p...The Halting problem
We learn about the halting problem in computability theory. It is as follows, Given an algorithm and its initial input, we determine if the algorithm when executed in this input will ever stop/halt. If it does not halt, it runs forever in an infinite loop.
Table of contents.Introduction.Proving the halting problem.Reduction and consequences.Summary.References.Introduction.In computability theory we describe the halting problem as follows;
Given an algorithm and its initial input, we det...
Recursive and Recursively Enumerable Languages
In this article, we learn about the properties of recursive and recursively enumerable languages in terms of union, intersection, and complements and compare the two languages.
Table of contents.Introduction.Differences between recursive and recursively enumerable languages.Properties of both recursive and recursively enumerable languages.Summary.References.Introduction.When a turing machine T operates on an input string S, there are three outcomes, these are;
It halts and accepts the ...April 9, 2022
Non Deterministic Turing Machines
In this article, we learn about non-deterministic turing machines - a generalization of the standard deterministic turing machine from a uniquely determined sequence of computation steps to several possible sequences of computational steps.
Table of contents.Introduction.A formal definition.Properties of non-deterministic turing machines.The complexity of non-deterministic turing machines.Summary.References.Introduction.A turing machine is a theoretical machine that manipulates symbols...
Types of Turing Machines
A turing machine is a mathematical model of a computation defining an abstract machine. In this article, we learn about the different variations/types of turing machines.
Table of contents.Introduction.Types of turing machines.Applications of turing machines.Summary.References.Prerequisite.Turing machinesIntroduction.A turing machine is a mathematical model of a computation that defines an abstract machine. In the prerequisite article, we learned about Turing machines, how they are ...
Time and Space Complexity of Comb Sort
In this article, we will learn about Time Complexity and Space Complexity of Comb Sort algorithm, with the in-depth mathematical analysis of different cases. Comb Sort is also known as Dobosiewicz Sort.
In short,
Time Complexity:-O(n2) for the Worst CaseO(n2/2p) for the Average Case, where, p is the number of increments.O(nlog(n)) for the Best CaseSpace Complexity: O(1)IndexComb Sort Algorithm in briefAnalysing the Time Complexity forWorst CaseAverage CaseBest CaseAnalysing t...Turing Machines and Church-Turing Thesis in Theory of Computation
A turing machine is a mathematical model of a computation that defines an abstract machine. In this article, we learn about Turing machines, how they are defined formally and informally, and the Church-Turing thesis.
Table of contents.Introduction.Formal and informal definitions.Multi-tape turing machines.Formal definition of multi-tape turing machines.The Church-Turing thesis.Summary.References.Prerequisites.Mathematical groundwork and proofsFinite Automata and Regular LanguagesCo...April 8, 2022
Separate chaining collision resolution technique
In this article, we are going to see how we can actually resolve the collisions which happen during hash mapping using Separate chaining collision resolution technique.
Table of contents:
Introduction of Hash Table and CollisionsSeparate chaining collision resolution techniqueExample of Separate chaining collision resolution techniqueTime and Space ComplexityImplementation of Separating Chaining resolutionApplicationsIntroduction of Hash Table and CollisionsAs the name suggests, hash ta...
April 7, 2022
JWT and It's Best Practices
In this article, we are going to cover a detailed explanation of JWT. Why do we use it? How we will make it work. We will be also covering the best practices of using JWT.
Table Of Contents:
What is JWT?The problem we are solving with JWTWorking principles of JWTBasic structureBest practices to followAlternatives of JWTWhat is JWT ?JSON Web Token (JWT) or as many call it "Jot". Authentication, authorization and in some cases some even use it for Stateless Session management. However, to...
April 6, 2022
nohup command in Linux
We use the nohup command to keep a process from being killed when the kernel sends the SIGHUP signal to the process when the terminal is closed. In this article, we learn about this command through examples.
Table of contents.Introduction.Syntax,Summary.References.Introduction.In Linux, while we are running a process in the terminal and suddenly close it. The process is automatically terminated. In other cases, we might be connected to a remote host via SSH performing critical operations...