當前位置:編程學習大全網 - 電腦編程 - 在計算機編程數據結構壹道超簡單的題,求代碼!速度要快!!

在計算機編程數據結構壹道超簡單的題,求代碼!速度要快!!

假定使用單鏈表。

簡單使用 reverse 函數即可。

typedef?int?elemcontent_t;

typedef?struct?node_s?{

elemcontent_t?data;

struct?node_s?*next;

}?node_t,?*node_h;

node_h?reverse(?node_h?head?)?{

node_h?h?=?NULL;

while?(?head?)?{

node_h?next?=?head->next;

head->next?=?h;

h?=?head;

head?=?next;

}

return?h;

}

//?definition

node_h?first;

//?caller

first?=?reverse(?first?);

  • 上一篇:為什麽說學單片機用C語言比較好?為什麽說C語言的可移植性好?體現在哪?
  • 下一篇:matlab 編程問題 對函數句柄求積分 在線等!!
  • copyright 2024編程學習大全網