【數據結構】單鏈表循環左移K位

例如鏈表數據有:1 2 3 4 5 6 7 8 910code 左移2位 結果爲 3 4 5 6 7 8 9 10 1 2class 須要處理邊界狀況 :左移11位 顯示錯誤 ,左移0位 顯示錯誤 ,左移10位 顯示錯誤。List void leftshift(LinkList List, int num) { int cnt = 0;//表示當前的位置 LinkList now = List
相關文章
相關標籤/搜索