Recent content by fadi_nzr

  1. F

    Check Balance of Parens, Brackets, and Curly Brackets

    how he said the result will be "matching".
  2. F

    Check Balance of Parens, Brackets, and Curly Brackets

    I tried "a(" and it returned 0 !
  3. F

    Check Balance of Parens, Brackets, and Curly Brackets

    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 <...
  4. F

    Check Balance of Parens, Brackets, and Curly Brackets

    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)
  5. F

    Check Balance of Parens, Brackets, and Curly Brackets

    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
  6. F

    Check Balance of Parens, Brackets, and Curly Brackets

    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...
  7. F

    Check Balance of Parens, Brackets, and Curly Brackets

    ohh, yeah I am not getting what I a, suppose to get. I want to know my mistakes first time dealing with stack
  8. F

    Check Balance of Parens, Brackets, and Curly Brackets

    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...
  9. F

    Sequence diverges or converges

    ( 3,0,3,0,3,0) is my professor answer to this part but as you see we are not getting close to that
  10. F

    Sequence diverges or converges

    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)
  11. F

    Sequence diverges or converges

    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)
  12. F

    Sequence diverges or converges

    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...
  13. F

    Optimizing Crease Length for a Folded Sheet of Paper

    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...
Back
Top