C++单向链表逆序为新的单向链表(整形)并按大到小排序
来源:百度知道 编辑:UC知道 时间:2024/06/07 13:09:31
1.C++单向链表逆序为新的单向链表(整形.数随机)
2.上题并按大到小排序
2.上题并按大到小排序
#include <iostream>
#include <ctime>
#include <cstdlib>
template <class T>
class SLLFolk { // SLL common properties
protected:
SLLFolk(){}
struct Node
{
T data;
Node* next;
};
static void _imp_reverse(Node* node, Node*& agentHead)
{
if(node)
{
_imp_reverse(node->next, agentHead);
agentHead-&g