[SOLVED] 代写 C data structure algorithm Data Structure Homework 3

30 $

File Name: 代写_C_data_structure_algorithm_Data_Structure_Homework_3.zip
File Size: 555.78 KB

SKU: 1772595205 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Data Structure Homework 3
Department of Information Management Beijing Jiao Tong University (Wei Hai)
Problem: (5 points)
As discussed in lectures, please write C codes for the following algorithm:
Algorithm ParenMatch(X,n):
Input: An array X of n tokens, each of which is either a grouping symbol, a variable, an arithmetic operator, or a number
Output: true if and only if all the grouping symbols in X match
Let S be an empty stack
for i=0 to n-1 do
if X[i] is an opening grouping symbol then S.push(X[i])
else if X[i] is a closing grouping symbol then if S.isEmpty() then
return false {nothing to match with}
if S.pop() does not match the type of X[i] then
return false {wrong type} return true {every symbol matched}
else
return false {some symbols were never matched}
Requirement:
(1) Write C codes to implement the abovementioned algorithm. (3 points)
(2) Write homework report to describe how you implement this algorithm, including
4 cases. (1 point)
(3) Include C codes in your report. (1 point)
Submission:
Submit your homework assignment (C code and report in a zip file, with your student ID+English name as zip file name) to class representative before October 18 23:59:59.
if S.isEmpty() then
1

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 C data structure algorithm Data Structure Homework 3
30 $