link<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n typedef struct PolyNode *Polynomial;<\/p>\n struct PolyNode{ \n <\/p>\n \u200b int coef;<\/p>\n \u200b int expon;<\/p>\n \u200b Polynomial link;<\/p>\n }<\/p>\n \u7ebf\u6027\u8868(Linear List)<\/h2>\n\u7ebf\u6027\u8868\u7684\u5b9a\u4e49<\/h3>\n\u7531\u540c\u7c7b\u578b\u6570\u636e\u5143\u7d20\u6784\u6210\u6709\u5e8f\u5e8f\u5217\u7684\u7ebf\u6027\u7ed3\u6784<\/p>\n \u8868\u4e2d\u5143\u7d20\u7684\u4e2a\u6570\uff1a\u7ebf\u6027\u8868\u7684\u957f\u5ea6<\/p>\n \u8868\u4e2d\u6ca1\u6709\u5143\u7d20\uff1a\u7a7a\u8868<\/p>\n \u8868\u8d77\u59cb\u4f4d\u7f6e\uff1a\u8868\u5934\uff1b\u8868\u7ed3\u675f\u4f4d\u7f6e\uff1a\u8868\u5c3e<\/p>\n \u7ebf\u6027\u8868\u7684\u62bd\u8c61\u6570\u636e\u7c7b\u578b\u63cf\u8ff0<\/p>\n \u7c7b\u578b\u540d\u79f0<\/strong>\uff1a \u7ebf\u6027\u8868(List)<\/p>\n\u6570\u636e\u5bf9\u8c61\u96c6\uff1a<\/p>\n \u64cd\u4f5c\u96c6\uff1a<\/p>\n \u7ebf\u6027\u8868\u7684\u987a\u5e8f\u5b58\u50a8\u5b9e\u73b0<\/h3>\n\u653e\u5728\u6570\u7ec4\u91cc\u9762<\/strong><\/p>\ntypedef<\/span> struct<\/span> LNode *<\/span>List;<\/span> struct<\/span> LNode{ \n <\/span> ElementType Data[<\/span>MAXSIZE]<\/span>;<\/span> int<\/span> Last;<\/span>\/\/\u6570\u7ec4\u7684\u6700\u540e\u4e00\u4e2a\u5143\u7d20<\/span> }<\/span>;<\/span> struct<\/span> LNode L;<\/span>\/\/\u5b9a\u4e49\u4e00\u4e2a\u94fe\u8868<\/span> List PtrL;<\/span>\/\/\u5b9a\u4e49\u4e00\u4e2a\u6307\u5411\u94fe\u8868\u7684\u6307\u9488\uff1b\u7ebf\u6027\u8868\u7ed3\u6784\u7684\u6307\u9488<\/span> \/\/\u901a\u8fc7\u7ebf\u6027\u8868\u7ed3\u6784\u7684\u6307\u9488\u53ef\u4ee5\u77e5\u9053\u6570\u7ec4\u662f\u8c01\uff0cLast\u4f4d\u7f6e<\/span> <\/code><\/pre>\n\u8bbf\u95ee\u4e0b\u6807\u4e3ai\u7684\u5143\u7d20\uff1a<\/p>\n L.<\/span>Data[<\/span>i]<\/span>;<\/span> \/\/\u6216<\/span> PtrL-><\/span>Data[<\/span>i]<\/span>;<\/span> <\/code><\/pre>\n\u7ebf\u6027\u8868\u7684\u957f\u5ea6\uff1a<\/p>\n L.<\/span>Last +<\/span> 1<\/span>;<\/span> \/\/\u6216<\/span> PtrL-><\/span>Last +<\/span> 1<\/span> <\/code><\/pre>\n\u4e3b\u8981\u64cd\u4f5c\u7684\u5b9e\u73b0<\/h4>\n\n- \u521d\u59cb\u5316\uff08\u5efa\u7acb\u7a7a\u7684\u987a\u5e8f\u8868\uff09<\/li>\n<\/ol>\n
List MakeEmpty<\/span>(<\/span>)<\/span> { \n <\/span> \/\/\u8868\u7684\u8868\u793a\uff1a1.\u6570\u7ec4<\/span> \/\/ 2.\u4ee3\u8868\u6700\u540e\u4e00\u4e2a\u5143\u7d20Last<\/span> List PtrL;<\/span> \/\/\u6570\u636e\u7c7b\u578b\u662f struct LNode<\/span> \/\/\u7528malloc\u7533\u8bf7\u8fd9\u6837\u7684\u7ed3\u6784<\/span> PtrL =<\/span> (<\/span>List)<\/span>malloc<\/span>(<\/span>size0f<\/span>(<\/span>struct<\/span>(<\/span>LNode)<\/span>)<\/span>)<\/span>;<\/span> \/\/\u628a\u7ed3\u6784\u7684\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u8d4b\u503c\u4e3a-1<\/span> \/\/\u8868\u91cc\u9762\u6ca1\u6709\u5143\u7d20 \u7528 -1 \u8868\u793a<\/span> PtrL-><\/span>Last =<\/span> -<\/span>1<\/span>;<\/span> return<\/span> PtrL;<\/span>\/\/\u8fd4\u56de\u8fd9\u4e2a\u7ed3\u6784\u7684\u6307\u9488<\/span> }<\/span> <\/code><\/pre>\n\n- \u67e5\u627e<\/li>\n<\/ol>\n
int<\/span> Find<\/span>(<\/span>ElementType X,<\/span> List PtrL)<\/span> { \n <\/span> int<\/span> i =<\/span> 0<\/span>;<\/span> \/\/\u5faa\u73af\u67e5\u627eX\u7684\u4f4d\u7f6e<\/span> while<\/span>(<\/span>i <<\/span> PtrL.<\/span>Last &&<\/span> PtrL.<\/span>Data[<\/span>i]<\/span> !=<\/span> X)<\/span> i++<\/span>;<\/span> if<\/span>(<\/span>i ><\/span> PtrL.<\/span>Last)<\/span> return<\/span> -<\/span>1<\/span>;<\/span> else<\/span> return<\/span> i;<\/span> }<\/span> <\/code><\/pre>\n\n- \u63d2\u5165<\/li>\n<\/ol>\n
int<\/span> Insert<\/span>(<\/span>ElementType X,<\/span> int<\/span> i ,<\/span> List PtrL)<\/span> { \n <\/span> int<\/span> j;<\/span> \/\/\u5224\u65ad\u8868\u662f\u4e0d\u662f\u5df2\u7ecf\u5b58\u6ee1<\/span> \/\/MAXSIZE - 1\u662f\u6570\u7ec4\u5927\u5c0f<\/span> if<\/span>(<\/span>PtrL-><\/span>Last ==<\/span> MAXSIZE -<\/span> 1<\/span>)<\/span> { \n <\/span> printf<\/span>(<\/span>\"full\"<\/span>)<\/span>;<\/span> return<\/span>;<\/span> }<\/span> \/\/\u68c0\u67e5\u63d2\u5165\u4f4d\u7f6e\u7684\u5408\u6cd5\u6027<\/span> if<\/span>(<\/span>i <<\/span> 1<\/span> ||<\/span> i ><\/span> PtrL -><\/span> Last +<\/span> 2<\/span>)<\/span> { \n <\/span> printf<\/span>(<\/span>\"not legal\"<\/span>)<\/span>;<\/span> return<\/span>;<\/span> }<\/span> \/\/\u5c06ai ~ an \u5012\u5e8f\u5f80\u540e\u79fb\u52a8<\/span> \/\/\u8fd9\u91cc\u53ea\u6709\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u662f\u80fd\u79fb\u52a8\u7684\u6240\u4ee5\u5148\u79fb\u52a8\u6700\u540e\u4e00\u4e2a\u5143\u7d20<\/span> if<\/span>(<\/span>j =<\/span> PtrL-><\/span>Last;<\/span> j >=<\/span> i -<\/span> 1<\/span>;<\/span> j--<\/span>)<\/span> { \n <\/span> PtrL-><\/span>Data[<\/span>j +<\/span> i]<\/span> =<\/span> PtrL -><\/span> Data[<\/span>j]<\/span>;<\/span> }<\/span> \/\/\u65b0\u5143\u7d20X\u63d2\u5165<\/span> PtrL -><\/span> Data[<\/span>i -<\/span> 1<\/span>]<\/span> =<\/span> X;<\/span> \/\/Last\u6307\u5411\u6700\u540e\u5143\u7d20<\/span> PtrL -><\/span> Last++<\/span>;<\/span> return<\/span>;<\/span> }<\/span> <\/code><\/pre>\n\n- \u5220\u9664<\/li>\n<\/ol>\n
\u8ddf\u63d2\u5165\u662f\u76f8\u53cd\u7684\u64cd\u4f5c<\/p>\n int<\/span> Delete<\/span>(<\/span>int<\/span> i,<\/span>List PtrL)<\/span> { \n <\/span> int<\/span> j;<\/span> \/\/\u68c0\u67e5\u7a7a\u8868\u4ee5\u53ca\u5220\u9664\u4f4d\u7f6e\u7684\u5408\u6cd5\u6027<\/span> if<\/span>(<\/span>j
|