next up previous contents
Next: Polynomial Comparison Operators: Up: Implementation: The Complex_POLY_CELL Class: Previous: Insertion of Terms:

Building a List:

Note we use the complex vector class to implement this method.

\small
\begin{verbatim}
#include "complexpoly.h"
    // ************************************** //
    //  build a list                          //
    // ************************************** //
void Complex_POLY::build_list(Complex_VECTOR A)
{
  int i = -1;
  int number = A.getRowSize();
  Complex_POLY_CELL *temp,*again;
  if(number!=0){
    head = new Complex_POLY_CELL();
    head->element = A[++i];
    head->power = (unsigned)number- 1 -i;
    again = head;
    while(i<number-1){
      again->next = new Complex_POLY_CELL();
      again->next->element = A[++i];
      again->next->power = (unsigned int)number- 1 -i;
      again = again->next;
      }
    }
}



Jim Peterson
1999-04-22