urgent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • selam
    New Member
    • Nov 2006
    • 16

    urgent

    Hi ,
    I have got a data sturcture assignment which focuses on linked list with array implementation. My assignment is ,to write a code using a linked list by using array, a program that adds a polynomial.

    Thank you in advance
  • seforo
    New Member
    • Nov 2006
    • 60

    #2
    Can you tell us exactly where you have a problem (in your code ) so that we can help you

    Comment

    • selam
      New Member
      • Nov 2006
      • 16

      #3
      Originally posted by seforo
      Can you tell us exactly where you have a problem (in your code ) so that we can help you
      My problem is in writing the code.

      Thank you.

      Comment

      • smithan
        New Member
        • Nov 2006
        • 16

        #4
        selam,

        u need to give more details, like the language u need to use and if the polynomial is a command line input or through the program.......

        smitha

        Comment

        • selam
          New Member
          • Nov 2006
          • 16

          #5
          Originally posted by smithan
          selam,

          u need to give more details, like the language u need to use and if the polynomial is a command line input or through the program.......

          smitha
          The program is written using C++ programming language.And the user is going to enter the polynomial function.The program must add the polynomial.

          Comment

          • DeMan
            Top Contributor
            • Nov 2006
            • 1799

            #6
            turn the linked list into a stack (that is a one way linked-list where you can only operate on the top element). Then read the polynomial into two stacks (one for operands, one for operators) so that they are in reverse Polish notation. As you pop the elements from the stack you can evaluate them (which is what I assume you mean when you say "adds a polynomial".

            Simple really!

            Comment

            • selam
              New Member
              • Nov 2006
              • 16

              #7
              [QUOTE=DeMan]turn the linked list into a stack (that is a one way linked-list where you can only operate on the top element). Then read the polynomial into two stacks (one for operands, one for operators) so that they are in reverse Polish notation. As you pop the elements from the stack you can evaluate them (which is what I assume you mean when you say "adds a polynomial".

              Simple really![/QU
              I cann't write it with stack.The program must be written using linked list without using stack.But if you have the code by using stack ,please show me.

              Comment

              • DeMan
                Top Contributor
                • Nov 2006
                • 1799

                #8
                you can treat a linked list as a stack. A stack's push is adding to the end of a linked list. A stacks pop is taking off the end of a linkedlist.

                Comment

                Working...