#include <bits/stdc++.h>
using namespace std;
//节点类
struct node {
int val;
node *next;
};
bool isSorted(node *head) {
//如果单链表为空 或者只有一个节点 如需要进行判断,直接返回为true
if (!head || !head->next) return 1;
node *p = head->next; //p指向单链表中的第一个节点
for (node *t=p; t->next; t=t->next)
if (t->val > t->next->val) return false;
return true;
}