EBK DATA STRUCTURES AND ALGORITHMS IN C
EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
bartleby

Concept explainers

Question
Book Icon
Chapter 4, Problem 3PA
Program Plan Intro

Program to implement the algorithm “delimiterMatching()”:

Program Plan:

  • In “delimiterMatching()” function
    • Function “delimiterMatching()” takes input file name as parameter.
    • Read characters from input file one by one till end of file
    • If character is “(”or “[” or “{” push it into stack “stackk1”.
    • If character is “)”or “]” or “}” check stack “stackk1” is empty or not.
      • If stack is empty return “false”.
      • Otherwise check delimiter is properly matched or not.
        • If stack top is “(” and character is “)” pop stack top from “stackk1”.
        • If stack top is “[” and character is “]” pop stack top from “stackk1”.
        • If stack top is “{” and character is “}” pop stack top from “stackk1”.
        • If stack top is any other character, return “false”.
    • If character is “/” and next character is “*” set “flagg” as “false”.
    • Continuously read characters till finds “*/”. If it finds before end of file set “flagg” as “true”.
    • If stack is not empty, set “flagg” as “false”.
    • Return “flagg”.
  • In “main()” function
    • Read a file name from keyboard and call function “delimiterMatching()” by passing file name as parameter.
    • If “delimiterMatching()” return “true” print message that input is delimiter matched.
    • Otherwise print message that input is not delimiter matched.

Blurred answer
Students have asked these similar questions
Find the voltage V0 across the 4K resistor using the mesh method or nodal analysis. Note: I have already simulated it and the value it should give is -1.714V
Resolver por superposicion
Describe three (3) Multiplexing techniques common for fiber optic links
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning