Insertion Sort List
来源:互联网 发布:见微数据 搜披露 编辑:程序博客网 时间:2024/06/08 04:42
Sort a linked list using insertion sort.
class Solution {public: ListNode* insertionSortList(ListNode* head) { if(!head) return NULL; ListNode* pre=new ListNode(-1),*p=head,*q; while(head){ p=head->next; head->next=NULL; q=pre; while(q->next&&q->next->val<head->val ) q=q->next; head->next=q->next; q->next=head; head=p; } return pre->next; }};
0 0
- Insertion Sort List | leetcode
- Leetcode: Insertion Sort List
- [LeetCode] Insertion Sort List
- Insertion Sort List
- Leetcode: Insertion Sort List
- [LeeCode] Insertion Sort List
- leetcode-Insertion Sort List
- [LeetCode]Insertion Sort List
- Insertion Sort List
- 【LeetCode】Insertion Sort List
- LeetCode | Insertion Sort List
- LeetCode - Insertion Sort List
- Insertion Sort List
- Insertion Sort List
- Insertion Sort List
- Insertion Sort List
- [LeetCode] Insertion Sort List
- list - insertion sort - AC
- Android应用瘦身,从18MB到12.5MB
- 蛇形填数 数组解法(最简单)
- MAC OS的vue2.0环境搭建
- Java实现余弦定理计算文本相似度
- KMP算法
- Insertion Sort List
- 全栈工程师之Restful与Spring Boot详解
- Java温习——方法
- 接口测试请求方法封装
- mmap()函数用法详解
- oracle 中 set serveroutput on
- 1064. Complete Binary Search Tree
- 杂想
- 332. Reconstruct Itinerary