Write a program that checks if left and right braces

Assignment Help Data Structure & Algorithms
Reference no: EM13163640

The program and functions should have brief comments describing their purpose, inline comments 

Write a program that checks if left and right braces, brackets, and parentheses are balanced. Your
program should ask the user to provide symbols as a string and store the user provided input in a string named str. Write a function named balanceCheck(str)that will return true is str is balanced and false otherwise. Use a std::stack inside the balance Checkfunction to solve this problem. You can assume that users will not enter any white spaces in between the symbols. You can assume that users will only enter a string consists of braces ({or}), brackets ([or]), and parentheses ((or)).

A sample output is as follows:
Provide a sequence of symbols for balance check: [{(){()()}}]
The expression you have provided is balanced.

Provide a sequence of symbols for balance check: [{{]}}[]
The expression you have provided is not balanced.

Reference no: EM13163640

Questions Cloud

Given a set of integer numbers : Given a set of integer numbers as int A[ ] = { 12, 6, 51, 4, 3, 7, 19, 8, 0, 21}, please write down the divide and conquer procedure of quick sort (step by step), include all left and right positions adjustment, and overwriting.
Windows application that function like a banking account : Create a Windows application that function like a banking account register. Separate the business logic from the presentation layer. The graphical user interface should allow user to input the account name, number, and balance.
Create file lab7.java with a main method. : Create file Lab7.java with a main method. Inside your main method, write a segment of code which instantiates an object of the Student class (This class has been created for you in the  Student.java  file that is provided as part of this lab).
Testing a program based on varying : Testing a program based on varying input values without knowing what the code looks like is called _____.With _____ testing, you make sure that every instruction in the code is executed at least once.
Write a program that checks if left and right braces : Write a program that checks if left and right braces, brackets, and parentheses are balanced
Program that compares the number of possible sequences : Write a c++ program that compares the number of possible sequences of the length L that can be generated. The program must output a formatted list comparing the number of possible sequences for L=5,6,7,8,9. given size N=9
Program that displays the ball at a random : Write a C++ program that displays the ball at a random location and then makes the ball move down to the bottom of the screen. When the ball reaches the bottom of the screen, it should start these actions over again, appear-ing at another random l..
Two cyborgs walk into your home : Two cyborgs walk into your home, both claiming to be oracles for the graph 3-colorability decision problem. They both always give a yes/no answer in constant time for any instance, and are each self-consistent
Design a wireless network : (15%) Allen FINALLY has been able to secure broadband service to his home in a remote area of the country via newly installed telephone lines. He had a powerful desktop. But he wants to be able to sit on his deck when using his new laptop to do his o..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Algoithm to select to describe intrinsically recursive

Algoithms you select so you can describe and assess them. Write challenges did you face in process? How did you go about resolving them?

  Function to swap all the left-right subtrees of binary tree

Write a function, swapSubTrees, that swaps all of the left and right subtrees of a binary tree. write a method singleParent, that returns the number of nodes in a binary tree that have only one child.

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Write algorithm to calculate the median using queries

Calculate the median using as few queries as possible. Provide an algorithm which determines the median value using at most O(lg n) queries.

  Write algorithm to find median value using queries

As queries are expensive, you would like to calculate median using as few queries as possible. Provide the algorithm which finds median value using at most O(log n) queries.

  Creating sql statements

Create three SQL statements: the 1st statement should add pending amounts to appropriate accounts, the second statement should subtract the pending amounts from appropriate accounts,

  Creating an array

Determine which of the following commands is used to create an array?

  Devise ef?cient algorithm for computing probability

Given the probabilities r1, · · · , rn, the costs c1, · · · , cn, and the budget B, ?nd the redundancies m1, · · · , mn that are within the available budget and that maximize the probability that the system works correctly. Devise an ef?cient algo..

  Question about trigger

What are triggers used for, and why are they important in database systems? Give an example of a situation where a trigger would be appropriate.

  Portfolio planning using optimization

Set this problem up as a linear programming model in Excel, and use Solver to determine how the $10 million should be invested. What is the overall return (in dollars terms)

  Database design activities

Assume Ray wishes to start a DVD rental program at his stores that he plans to call Henry's DVD Club. He refers to each of his consumers as members.

  Provide polynomial-time algorithm to decide in graph

Provide a polynomial-time algorithm to decide whether G has unique minimum s - t cut (i.e., an s - t cut of capacity strictly less than that of all other s - t cuts).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd