Aditya Chatterjee's Blog, page 147

November 6, 2021

Types of Dimensionality Reduction Techniques

In this article, we will learn Why is Dimensionality Reduction important and 5 different Types of Dimensionality Reduction Techniques like Principal Component Analysis, Missing Value Ratio, Random Forest, Backward Elimination and Forward Selection.

Table of Contents:

IntroductionWhat is Dimensionality?What is Dimensionality Reduction?Why do we need Dimensionality Reduction?Types of Dimensionality Reduction Techniques
5.1. Principal Component Analysis
5.2. Missing Value Ratio
5.3. Random For...
 •  0 comments  •  flag
Share on Twitter
Published on November 06, 2021 05:32

November 5, 2021

Get current stock price in Python

In this article, we have covered how to get the current stock price in Python from Yahoo Finance using two Python libraries, Beautiful Soup, and the Requests library.

Table of contents:

Basics of Yahoo FinanceInstall the libraries neededImport the packagesUse Requests to send an HTTP request to Yahoo Finance websiteUse Beautiful Soup to parse the contentInspect the page to retrieve the stock data

The full code is at the end of the article at OpenGenus.

Yahoo Finance

Yahoo Finance (finance...

 •  0 comments  •  flag
Share on Twitter
Published on November 05, 2021 00:35

Maximum String Partition problem: Partition Labels

In this article, we have explored approaches to solve the maximum string partition problem (Partition Labels) efficiently.

Table of contentsProblem statementBrute Force approachLogic for Efficient ApproachEfficient AlgorithmFinal code

This is similar to Leetcode problem 763. Partition Labels.

Problem Statement

Given a string of alphabets, partition the string in maximum number of parts such that each letter appears in only one part. Output the number of partition and size of partitions.

S...
 •  0 comments  •  flag
Share on Twitter
Published on November 05, 2021 00:12

November 4, 2021

Alien Dictionary problem: Sorted order of characters

In this article, we are given a sorted list of words in some alien dictionary. Based on the list, we have to generate the sorted order of characters in that alphabet. This problem can be solved using the idea of Topological Sort and Direct Acyclic Graphs. So, let's begin!

Table of contents:

Understanding Topological SortAlien Dictionary ProblemWhat we are supposed to doOur approach

Prerequisite: Topological Sort

This is similar to Leetcode problem 269. Alien Dictionary.

Understanding Topolo...
 •  0 comments  •  flag
Share on Twitter
Published on November 04, 2021 12:13

Shortest Superstring problem

Hey Guys 🎉, in this article, we have explained three approaches to solve the Shortest Superstring problem. This involve concepts like DFS and Dynamic Programming.

Table of contents:

Problem StatementApproach 1: Brute-Force (Back-Tracking)Approach 2: Search + Pre-CompilingApproach 3: Dynamic Programming

This is similar to Leetcode problem 943. Find the Shortest Superstring.

Problem Statement

Let's discuss a hard yet very intresting problem named "Shortest SuperString Problem".

The problem st...

 •  0 comments  •  flag
Share on Twitter
Published on November 04, 2021 11:06

Swap Nodes in Pairs

Swap Nodes in Pairs

In this article, we have explained an efficient approach to Swap adjacent nodes in a Singly Linked List inplace. We have presented both Iterative and Recursive implementation.

Table of contents:

Problem StatementApproachIllustrationIterative SolutionRecursive Solution

This is similar to Leetcode Problem 24. Swap Nodes in Pairs.

Problem Statement

We’re given the pointer to the head of a singly linked list, we're asked to reverse each two adjacent nodes and return the pointer/reference to th...

 •  0 comments  •  flag
Share on Twitter
Published on November 04, 2021 09:48

All O`one Data Structure

In this post, we will design a Data Structure that returns the string occurring maximum and minimum times in constant time O(1). This will use a hashmap and a doubly linked list utilizing the advantages of each to solve the problem.

hashlink

Table of contents:

Problem StatementNaive Approach (Using a 2D doubly linked list)Optimized approach (Using hash map and doubly-linked list)Time & Space Complexity Analysis

To attempt similar problems on Designing Data Structure, go to this list.
This is simila...

 •  0 comments  •  flag
Share on Twitter
Published on November 04, 2021 09:21

Substring with Concatenation of All Words

In this article, we have explained two approaches to solve the problem Substring with Concatenation of All Words. This involves the idea of Hash Map and Two Pointer.

Table of ContentsProblem StatementApproach 1: Hash MapApproach 2: Two pointerComparison of methods

This is similar to Leetcode Problem 30. Substring with Concatenation of All Words.

Problem Statement

Let's say that we are given a list of strings L of N strings, and a string S. We need to find the substrings in S which are a co...

 •  0 comments  •  flag
Share on Twitter
Published on November 04, 2021 08:41

Time & Space Complexity of Heap Sort

In this article, we have explained Time & Space Complexity of Heap Sort with detailed analysis of different cases like Worst case, Best case and Average Case.

Table of contents:

Overview of Heap SortTime complexity of Heap Data StructureWorst Case Time Complexity of Heap SortBest Case Time Complexity of Heap SortAverage Case Time Complexity of Heap SortSpace Complexity of Heap SortConclusion

Prerequisite: Heap Sort, Heap Data Structure

Let us get started with Time & Space Complexity of H...

 •  0 comments  •  flag
Share on Twitter
Published on November 04, 2021 07:40

Rotate Image: matrix of size NxN by 90 degrees (clockwise)

In this article, we have explored an efficient way to Rotate Image: matrix of size NxN by 90 degrees (clockwise) inplace by using a property of XOR operation.

Table ContentsIntroductionAlgorithmCode in C++ and ImplementationFinal considerations

Prerequisite: Bitwise operations, Applications of XOR operation

This is similar to Leetcode problem 48. Rotate Image.

1. Introduction

Rotation is part of Geometric Transformations, along with translation and scale.

translation is related to the ele...
 •  0 comments  •  flag
Share on Twitter
Published on November 04, 2021 07:02