資料結構作業6 鍊錶的改進及其應用(程式設計題)

2021-09-03 09:01:09 字數 1122 閱讀 7516

設計函式求一元多項式的導數。

以指數遞降方式輸入多項式非零項係數和指數(絕對值均為不超過1000的整數)。數字間以空格分隔。

以與輸入相同的格式輸出導數多項式非零項的係數和指數。數字間以空格分隔,但結尾不能有多餘空格。

3 4 -5 2 6 1 -2 0

12 3 -10 1 6 0

#include

intmain()

}if(flag==0)

printf

("0 0");

return0;

}

#include

#include

#include

#define true 1

#define false 0

#define ok 1

#define error 0

#define infeasible -1

#define overflow -2

typedef

int status;

typedef

struct

elemtype;

typedef

struct lnode

lnode,

*linklist;

typedef linklist polynomial;

status initpoly

(polynomial &p)

status scanpoly

(polynomial &p)

return ok;

}status derivativepoly

(polynomial &p)

else

}return ok;

}status printpoly

(polynomial p)

if(flag==0)

printf

("0 0");

return ok;

}int

main()

資料結構 鍊錶及其基本操作

鍊錶有查詢 刪除 插入 排序 等等一系列的操作 首先還是要先從定義開始 include include struct kk void hh struct kk he 此函式為刪除鍊錶的記憶體 free he return null 排序 鍊錶可以像陣列一樣也可以對其中的值進行排序 公升序或降序 由於...

鍊錶實現佇列 資料結構作業

仿照作業code1的功能,將課本上鍊表的實現佇列能完整實現 需要通過main函式呼叫並能進行友好的人機互動輸入 作業code1 鍊錶實現佇列的 include define ok 1 define error 0 using namespace std typedef int qelemtype t...

資料結構作業 有表頭鍊錶

雖然大部分是模仿的,但是總算是用了兩個小時把這個作業弄完了。第一次寫迭代器和template。迭代器嗎 基本就是乙個型別,把 過載一下就搞定了。有表頭鍊錶 1template class t 2struct head list node 9 head list node constt t 13 14...