## Program to Construct LL(1) Parsing Table in c

Given a LL(1) Grammar, write a program to display LL(1) parsing table for the grammar. The program reads data from the file.

Skip to content
## Program to Construct LL(1) Parsing Table in c

## FIRST FOLLOW

## Binary Tree Level Order Traversal

## Why Binary Search is Preferred over Ternary Search?

## Ternary Search

## Check if the given string is interleaving of two other strings

## How to sort an array in descending order using sort() in c++?

## Difference Between Stack and Queue

## Queue

## Postfix to Infix

Given a LL(1) Grammar, write a program to display LL(1) parsing table for the grammar. The program reads data from the file.

FIRST(A) is defined as a set of terminals that begin the strings defined by A. If A derives ‘Є’ then ‘Є’ is in FIRST(A).FOLLOW(A) for a non-terminal A is defined as a set of terminals that can appear on the right side of A in the sentential form. FOLLOW is only applied for non-terminals. The FOLLOW of start symbol always contain the end marks ‘$’.

Given a Binary Tree, print level order traversal. Example, Input Binary Tree Output 10 5 20 4 8 15 25 Algorithm We will discuss two ways to print the level order traversal of the binary tree. Both use queue and are very similar. Level Order Traversal Using Queue First Approach As we know, queue follows …

Binary search and Ternary search algorithms are used to search an element in a sorted array. Binary search reduces the array by 1/3 on each iteration whereas Ternary search reduced array size by 1/3 on each iteration. The Time complexity of Binary Search is log2(N).The Time complexity of Ternary Search is log3(N). Ternary search should …

Why Binary Search is Preferred over Ternary Search? Read More »

Ternary search is a searching algorithm that searches an element in a sorted array. Algorithm Ternary search works similar to Binary search. The only difference is instead of dividing the array into 2 parts, the array is divided into three parts and 2 parts are rejected on each iteration. That is, the array is reduced …

Given 3 strings, we need to determine if third string is interleaving of first and second string. Example, STRING 1: AB STRING 2: XY STRING 3: XABY OUTPUT: TRUE Solution First, we need to understand what interleaving means. Suppose we are given two string AB and XY Now, the strings that can be formed by …

Check if the given string is interleaving of two other strings Read More »

The C++ STL function sort() by default sorts the array in ascending order. If we want to sort array in descending order using sort(), we need to use a Comparator Function. Syntax Sort Array in Descending Order Using sort() We can use the inbuilt greater<type>() function to arrange array in descending order. greater<type>() compares the …

How to sort an array in descending order using sort() in c++? Read More »

The main difference a stack and queue is stack follows Last in First Out (FIFO) whereas queue follows First In First Out (FIFO) principle.

Queue is a linear data structure. It follows First In First Out (FIFO). In other words, the item which is inserted first is accessed/deleted first. For example, when you go to cashier in a mall, then the person first in line is served first. This is a queue. Basic Operations:- enqueue/push: Insert item in the …

We can convert any postfix expression to infix expression using stack in one pass. Example Input: abc^d/e*+ Output: (a+(((b^c)/d)*e)) Postfix to Infix Algorithm Steps Initialize an empty stack. Scan postfix expression from left to right. If the scanned character is an operand, push it to the stack. If the scanned character is an operator, Pop …