EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 4, Problem 3PA
Program Plan Intro
Program to implement the
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.
Expert Solution & Answer
Trending nowThis is a popular solution!
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
Chapter 4 Solutions
EBK DATA STRUCTURES AND ALGORITHMS IN C
Knowledge Booster
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
- Write a Java generic sort function, the generic sort function takes an array of objects as input and sorts them in place, You can assume that the objects e the array do implement the Comparable Interface, in other words, obj1.compareTo(obj2) returns -1,0, or 1 if objt is less than, equal or greater than obj2, respectively. You are free to pick any sorting algorithm (bubble sort, insertion, heap sort, etc.).arrow_forwardDevelop a class ResizingArrayQueueOfStrings that implements the queueabstraction with a fixed-size array, and then extend your implementation to use arrayresizing to remove the size restriction.Develop a class ResizingArrayQueueOfStrings that implements the queueabstraction with a fixed-size array, and then extend your implementation to use arrayresizing to remove the size restriction.arrow_forwardWrite a program using C++ that uses a hashing algorithm to create a list of students present in a class. Consider the student numbers as keys, while implementing rotation, fold boundary methods and linear probing (include modulo division if necessary) for an array-based list of length 1000. After creating the list, allow the user to search for the name of a student and report its student number.arrow_forward
- For the AVLTree class, create a deletion function that makes use of delayed deletion.There are a number of methods you may employ, but one that is straightforward is to just include a Boolean variable in the Node class that indicates whether or not the node is designated for deletion. Then, all of your other techniques must take this field into consideration.arrow_forwardThe purpose of this assignment is to practice using Recursion with backtracking to solve a maze. I need help to implement the private static void solve(Maze maze, Coordinate currentPos, ArrayList<Coordinate> path, ArrayList<Coordinate> history) method in the MazeSolver class.arrow_forwardWrite a program that implements the algorithm delimiterMatching() seen in class.arrow_forward
- Write a class that maintains the top ten scores for a game application,implementing the add and remove methods of Section 3.1.1 in the textbook, but using a singly linked list instead of an array. You need to implement the singly linked list yourself. Textbook reference is Data structures and algorithms Micheal Goodricharrow_forwardGiven an array that represents Breadth First Search or BFS traversal of a Complete Binary Search Tree, implement a recursive void method to print the preOrder traversal of the same Complete Binary Search Tree. You do not need to construct the BST. A Complete Binary Search Tree is a BST in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible. Following is an example of a Complete Binary Search Tree: A. BFS traversal array (level by level from left to right): bfs[] = {50, 35, 55, 30, 45} B. PreOrder traversal (middle, left, right) : 50 35 30 45 55 Your recursive method "void convertBFStoPreOrder" will get an array A as an input and will print B. Hints: In the given BFS traversal array, bfs[], if i is the index of a parent, 2i+1 will give you the index of the left child, and 2i+2 will give you the index of the right child. "Assume that input array is always correct and represent a correct BFS traversal of a Complete BST."…arrow_forwarddevelop a java program for :arrow_forward
- Write a Java program that uses ArrayList and Iterator. It should input from user the names and ages of your few friends in a loop and add into ArrayList. Finally, it should use an Iterator to display the data in a proper format. ( Sample run of the program:-) List of my Friends Enter name and age [friend# 0] Khalid Al-shamri 22.5 Do you want to add another friend (y/n)? y Enter name and age [friend# 1] Rahsed Al-anazi 21.1 Do you want to add another friend (y/n)? y Enter name and age [friend# 2] Salem Al-mutairi 23.7 Do you want to add another friend (y/n)? n Here is the data you entered: 0. Khalid Al-shamri, 22.5 1. Rahsed Al-anazi, 21.1 2. Salem Al-mutairi, 23.7arrow_forwardYou are given an array-like data structure Listy which lacks a size method. It does, however, have an elementAt ( i) method that returns the element at index i in 0( 1) time. If i is beyond the bounds of the data structure, it returns -1. (For this reason, the data structure only supports positive integers.) Given a Listy which contains sorted, positive integers, find the index at which an element x occurs. If x occurs multiple times, you may return any index. Write code with explanationarrow_forwardUsing classes , write down a program that implements creation of a head pointer of a linked list , then add first node to the list and make it pointing to null .arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning