Aditya Chatterjee's Blog, page 96
April 20, 2022
Types and Declarations in Intermediate Code Generation
In this article, we learn about types and the storage layouts for names declared within a procedure or class which are allocated at run time when the procedure is called or an object is created.
Table of contents.Introduction.Type expressions.Type equivalence.Declarations.Storage layout for local names.Sequences and declarations.Records and classes fields.Summary.References.Introduction.Applications of types are grouped under checking and translation. First type checking is used to ...
Evaluation Orders for SDDs
In this article, we learn about evaluation orders for syntax-directed definitions. Dependency graphs are used to determine an evaluation order for instances of attributes in a parse tree.
Table of contents.Introduction.Dependency graphs.Ordering the evaluation of attributes.S-Attributed Definitions.L-Attributed Definitions.Semantic rules with controlled side effects.Summary.References.Prerequisites.Introduction.We use dependency graphs to determine an eva...
Reverse a Queue using Stack
In this article, we have explored how to reverse a Queue using Stack data structure.
Table of contents:
Introduction to problem statementAlgorithm/ StepsDemonstrationImplementationTime and Space ComplexityPre-requisite:
Queue Data StructureStack Data StructureTypes of Queue and their implementationsIntroductionGive an algorithm for reversing a queue Q. Only following standard operations are allowed on queue.
enqueue(x) : Add an item x to rear of queue.
dequeue() : Remove an item fro...
Reverse a Queue using another Queue
In this article, we will explore how to reverse a Queue using another Queue.
Table of contents:
Introduction to QueueReverse Queue using QueueImplementationPre-requisite:
Queue Data StructureTypes of Queue and their implementationsIntroduction to QueueIt is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). It is an important data structure.
Example- Movie ticket counter queue, it is any queue of consumers...
April 19, 2022
Longest Increasing Subsequence [3 techniques]
As the name suggest Longest Increasing Subsequence is to find the longest increasing subsequence in sequence such that elements of subsequence are in sorted increasing order.
Approcah to Solve this problem:
Longest Increasing Subsequence problem can be solved with the help of 3 different Approach:
Time Complexity of LIS:
Brute force: O(N^2)Dynamic Programming: O(n^2)Binary Search: O(nlogn)Using Binary Search is a efficient Meth...
Different Hybrid Sorting Algorithms
In this article, we will discuss about various Hybrid sorting algorithms such as Tim Sort Algorithm. Hybrid Sorting Algorithms tend to perform better than pure Sorting Algorithms and hence, are widely used in practice.
What we will see:-
Hybrid AlgorithmsHybrid Sorting AlgorithmsTim Sort AlgorithmTime ComplexitySpace ComplexityPseudo code for Tim sortIntro Sort AlgorithmTime ComplexitySpace ComplexityPseudo code for Intro sortSpread Sort AlgorithmTime ComplexitySpace Complexi...Modal using CSS only
In this article, we will implement a Modal using only plain CSS without the help of JavaScript.
Table of Contentwhat is Modal anyway?Why do we need Modal?Rough idea of implementation.Actual Modal code(In CSS).Benefits of Modal?What is Modal?A Modal is a web element that is displayed in front of and deactivate back element, to return to the main content user must interact with the Modal, or close the Modal then backside deactivated page is activated.
To tell in a s...
April 18, 2022
Wait for page load in Selenium (Python)
In this article, I will show 3 different ways to wait for page to load in Python using Selenium.
Table Of Contents:
SeleniumWhy wait for the page to loadQuick Selenium setupImplements of wait in SeleniumImplicit waitExplicit waitFluent waitSeleniumSelenium is a free automated testing framework used to validate different web applications from other browsers and platforms. Selenium testing can be done with many different programming languages, such as Java or Python, and many more.
Why w...April 16, 2022
Syntax-Directed Translation Schemes
In this article, we learn about syntax-directed translation schemes, a complementary notation to syntax-directed definitions.
Table of contents.Introduction.Postfix translation schemes.Parser-stack implementation of postfix SDTs.SDTs with actions inside productions.Eliminating left-recursion.SDTs for L-Attributed definitions.Summary.References.Introduction.A translation scheme is a context-free grammar whereby semantic rules are embedded within the right sides of productions.
A trans...
Applications for Syntax-Directed Translation
In this article, we learn about the main application of Syntax-directed Translation which is the construction of syntax trees.
Table of contents.Introduction.Building syntax trees.The structure of a type.Summary.References.Introduction.The main application of Syntax-Directed Translation is in the construction of syntax trees. Compilers use syntax trees as an intermediate representation, using a common form of Syntax-Directed Definitions, the input string is converted into a tree.
The co...