1 6 遞增的整數序列鍊錶的插入 10 分

2021-09-27 02:31:48 字數 831 閱讀 9841

list insert( list l, elementtype x );

typedef struct node ptrtonode;

struct node ;

typedef ptrtonode list; / 定義單鏈表型別 */

l是給定的帶頭結點的單鏈表,其結點儲存的資料是遞增有序的;函式insert要將x插入l,並保持該序列的有序性,返回插入後的煉表頭指標。

#include #include typedef int elementtype;

typedef struct node *ptrtonode;

struct node ;

typedef ptrtonode list;

list read(); /* 細節在此不表 */

void print( list l ); /* 細節在此不表 */

list insert( list l, elementtype x );

int main()

/* 你的**將被嵌在這裡 */

5

1 2 4 5 6

3

1 2 3 4 5 6

list insert( list l, elementtype x )

if(q==null)

t->next=p;

else

}return l;

}

遞增的整數序列鍊錶的插入

遞增的整數序列鍊錶的插入 本題要求實現乙個函式,在遞增的整數序列鍊錶 帶頭結點 中插入乙個新整數,並保持該序列的有序性。函式介面定義 list insert list l,elementtype x 其中list結構定義如下 typedef struct node ptrtonode struct ...

遞增的整數序列鍊錶的插入

本題要求實現乙個函式,在遞增的整數序列鍊錶 帶頭結點 中插入乙個新整數,並保持該序列的有序性。函式介面定義 list insert list l,elementtype x 其中list結構定義如下 typedef struct node ptrtonode struct node typedef ...

PTA 遞增的整數序列鍊錶的插入

題目鏈結 需要許可權 本題要求實現乙個函式,在遞增的整數序列鍊錶 帶頭結點 中插入乙個新整數,並保持該序列的有序性。函式介面定義 list insert list l,elementtype x 其中list結構定義如下 typedef struct node ptrtonode struct no...