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
Write and implement a recursive version of the binary search algorithm. Also, write a version of the sequential search algorithm that can be applied to sorted lists. Add this operation to the class orderedArrayListType for array-based lists. Moreover, write a test program to test your algorithm.
Perform the previous project, but use a doubly linked list. Moreover, your implementation of remove(i) should make the fewest number of pointer hops to get to the game entry at index i. You need to implement the doubly linked list yourself. Problem 3!!
how to implement this function by giving another example like this function or any similar  : int* returnNeighbors(int v);// returns the indices of the neighbors of the vertex v as an int array
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