目录html
更新、更全的《数据结构与算法》的更新网站,更有python、go、人工智能教学等着你:http://www.javashuo.com/article/p-zfinzipt-hh.htmlpython
/* c语言实现 */ Ptr Reverse(Ptr head, int K) { cnt = 1; new = head->next; old = new->next; while (cnt < K) { tmp = old->next; old->next = new; new = old; old = tmp; cnt++; } head->next->next = old; return new; }
取巧:用顺序表存储,先排序,再直接逆序输出。算法
对上述取巧的解决方案:在内存里多加几个没用的结点。数据结构
在pta测试中,这道题的测试数据主要关心一下几点:测试