刪除相同元素 線性表

2021-06-21 09:20:47 字數 793 閱讀 3868

description

(線性表)在乙個遞增有序的線性表中,有數值相同的元素存在。若儲存方式為單鏈表,設計演算法去掉數值相同的元素,使表中不再有重複的元素。

input

輸入長度:6

輸入資料:2 3 4 5 5 7

output

2 3 4 5 7

sample input

68 9 10 11 22 22

sample output

8 9 10 11 22

#include using namespace std;

struct number

;number *creatlink(number *head,int n);

number *dellink(number *head);

int main()

return 0;

}number *creatlink(number *head,int n)

p->next=null;

return head;

}number *dellink(number *head)

if(s->num==p->num&&s->next==null)

q->next=null;

else

q->next=s;

p=q->next;

} else

p=p->next;

if(p==null)

break;

} return head;

}

刪除相同元素 線性表

線性表 在乙個遞增有序的線性表中,有數值相同的元素存在。若儲存方式為單鏈表,設計演算法去掉數值相同的元素,使表中不再有重複的元素。輸入長度 6 輸入資料 2 3 4 5 5 7 2 3 4 5 7 68 9 10 11 22 22 8 9 10 11 22 include define null 0...

刪除相同元素 線性表

題目描述 線性表 在乙個遞增有序的線性表中,有數值相同的元素存在。若儲存方式為單鏈表,設計演算法去掉數值相同的元素,使表中不再有重複的元素。輸入輸入長度 6 輸入資料 2 3 4 5 5 7 輸出2 3 4 5 7 樣例輸入 68 9 10 11 22 22 樣例輸出 8 9 10 11 22 提示...

Problem A 刪除相同元素 線性表

time limit 1 sec memory limit 128 mb submit 489 solved 344 submit status web board 線性表 在乙個遞增有序的線性表中,有數值相同的元素存在。若儲存方式為單鏈表,設計演算法去掉數值相同的元素,使表中不再有重複的元素。輸入...