with this implementation worked for me/ what other ways I can do to push a single char instead of changing the string argument to const char
bool balanced(const string & line)
{
Stack sk;
initialize(sk);
if (line.size() > STACK_SIZE) die("stack overflow");
for (unsigned i = 0; i <...
I should say something like push(sk, line); // what I meant
but since one of the push function argument is string I cannot say that
so you mean I have to change
void push(Stack & stack, const char& item)
I know that I don't want to push the whole line, but instead just the char,
take look at my push function it has a string argument not char.
void push(Stack & stack, const string & item)
{
if (stack.elements == STACK_SIZE) die("Stack Underflow");
stack.data[stack.elements++] = item;
}//push
well, I believe there's an error in the switch ( ---- )
I am trying to check each single char of the given string and match it with the cases I have
so let's say the first char was '(' it will be pushed to the stack, but having the following if statement seem useless
that's why I posted my...
Hello
I am writing the balance function that should figure out whether the left and right parens ( ) , the left and right brackets [ ] , and the left and right curly brackets { } are properly matched and nested in the string arg. For instance,
examples...
for part A, now it looks complicated to me than before what my prof did is
moving the bottom to the numerator and you get infinity
for part B I still unable to get ( 3,0,3,0,3,0)
question 2
A-
actually this section was before the comparison theorem so let's assume we can't compare it for now
what is the other way B-it diverges but I don't know how to come up with these values as my values differ ( 3,0,3,0,3,0)
Question 1
write the first 4 terms in the sequence defined by a 1 = -2, a n+1 = an/n!
this what I tried
a2 = -2/1
a3 = -2/2
a4 = -1/6
Question 2
determine the following sequences converges or diverges
1- an = sqrt(n^2 -3 )/ 5th rt(n^2)
what I would try is to divide both...
You have a sheet of paper that is 6 units wide and 25 units long placed
so that the short side is facing you. Fold the lower right hand corner
over to touch the left side. Your task is to fold the paper in such a way
that the length of the crease is minimized. What is the length of the...