Posted by Eugene Teo on 1999-04-24
Hi I am revising for my Advanced Data Structures module and i have got 2 important questions to ask. Please help. Question 1: How do i go about writing a function that accepts an expression which is a string of characters and checks for matching parentheses using Stack Operatings? Also, besides parentheses, how do i go about writing a program that calculates expressions in the form of maths formulas? eg: (a+b(c+7)). First it will match the parameters, then it will calculate the values, assuming a, b, c have values assigned to them. i understand that i need 2 queues. please advise me and guide me with this. i need to understand those which are more application-based. Question 2: I am supposed to write a recursive function but i tried and think very hard yet, to no avail. The question is like this: (Please teach me. I have some difficulty learning recursive coz the the technique and the way it is program is very different.) A plaindrome is a string of characters that is the same when read forward or backward. Some examples of palindrones are: "radar", "noon" and "level". Write a recursive function to test a string in order to determine if it is a palindrome. Use the function prototype as follows: Boolean IsPalindrome(char *s); Please answer my question and teach me how i should approach the above questions and the topic on Recursion. Thank you very very very much. I really appreciate your help and time. Eugene -- eugeneteo@xxxxxxxxx.xxx.xx http://amnesia.serverity.com.sg/
Previous post | Next post | Timeline | Home