资 源 简 介
1、 程序功能:本程序实现多项式的求和运算,在遇到指数相同时实行系数相加或相减,指数不同的照原样输出。最后分别输出系数和指数。
2、 运行环境:C++
3、 算法描述:首先,把输入的的多项式进行分析,把所有的系数放入一个单链表中llist,指数放入另一个单链表llist2中。然后再在指数链表中比较有没有相同的指数,如果有相同的指数,那就把相对应的系数进行求和,并把求和结果归并到llist2中;如果指数不相等的,就直接归并到llist2中。最后以指数的降幂形式输出。
-1, function : the program summation Operational polynomial, in the face of phase with the introduction of index coefficient of additive or subtraction, the index of output as it stood. The final output coefficients and the respective indices. Two, the environment : C 3, the algorithm Description : First, the importation of a polynomial analysis of all the factors into a single linked list (which, the index Add another single linked list llist2 China. Then in the index compared Linklist have the same index, if the same index, then the corresponding coefficient for peace, and the summation of the results of merging llist2; If the index is not equal, direct incorporation of llist2 China. The final index to a lower output in the form of pow