DSA23 - C Program to Check String is Palindrome using Stack 

Download Solution Order New Solution

Assignment Task

Nest Checker and Palindrome using stacks

For this question you have to perform two operations, first is to check if a string is balanced or not. A string is called a balanced string when:

  • Iff it has brackets the opening and closing brackets are in a correct nested form. For example, is a balanced stringwhileis not.

The subsequent lines will contain the strings. There are no spaces inside the strings, therefore you can use normal scanf() to read the input.

Explanation

The first example has two strings as input. The first string has brackets in a nested order and is not a palindrome, hence the corresponding output is ”Balanced”. Similarly for the second input the string has brackets in the correct order as well as it is not a palindrome, hence the output is ”Balanced”

For the second example, the first input is balanced, the second input is not balanced nor Palindromic hence the corresponding output is ”-1”. The third input doesn’t have any brackets and is palindromic, hence the output is ”Palindromic”

Circular Deque

In this question, you have to implement an ADT called Circular Deque using queue data structure. A deque is known as double-ended queue. You can check more about Deque here. Now You have to implement a Circular Deque which performs the required operations

Output

The First Line of the output contains N space-separated integer numbers which represent the ”Beautiful”-traversal(Zig-zag Level order Traversal) of the tree

Problem Explanation

Construct Tree from given Inorder and Preorder traversals Hint - In a Preorder sequence, the leftmost element is the root of the tree. By searching for root in the Inorder sequence, we can find out all elements on the left side of it, is in the left subtree and elements on right in the right subtree

King and the Crisis

Once upon a time, there was a kingdom ruled by a wise King who loved nature and often went on forest walks. During one of his walks, he came across a beautiful Tree with several branches and leaves. The king, being a nature lover, decided to keep the tree as it was and even gave orders to his workers to take care of it. Years passed by, and the tree grew taller, stronger, and even bore fruits. However, the kingdom was facing a financial crisis, and the king decided to take the tree’s fruits and sell them so as a measure to overcome the crisis. But the workers, who had grown attached to the tree, requested the king to spare it. The king thought for a while and came up with an idea. He decided to make use of the tree’s branches to create a Binary Search Tree with every fruit hanging from those branches (each Node of the BST) having different Values V, hoping to use it as a source of income for the kingdom. However, the king soon realized that the tree was not ordinary, and he didn’t want to harm it in any way. He asked to workers to modify the tree such that each fruit’s price (Node’s Value) gets updated to the sum of all the values smaller or equal to the current fruit. The workers spent days trying to figure out a way to fulfil their Kings order but couldn’t find a way out.

This DSA23IT and Computer Science has been solved by our PHD Experts at My Uni Paper.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.