有序升序环链表,找到最小头
Node newhead = null; Node slow = head; Node fast = head.next; while(fast.val >= slow.val){ slow = slow.next; fast = fast.next; if(fast == head){ break; } }
然后从新头找到元素位置插入即可
有序升序环链表,找到最小头
Node newhead = null; Node slow = head; Node fast = head.next; while(fast.val >= slow.val){ slow = slow.next; fast = fast.next; if(fast == head){ break; } }
然后从新头找到元素位置插入即可
上一篇:小行星碰撞(使用deque操作)
下一篇:有序环链表按顺序插入元素
Go 单链表有序插入
本题要求实现递增顺序表的有序插入函数。L是一个递增的有序顺序表,函数Status ListInsert_SortedSq(SqLis
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M