Insertion Sort List -- leetcode
来源:互联网 发布:sql2008数据库恢复 编辑:程序博客网 时间:2024/06/02 18:02
Sort a linked list using insertion sort.
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* insertionSortList(ListNode* head) { ListNode fake(0); while (head) { ListNode *runner = &fake; while (runner->next && runner->next->val < head->val) runner = runner->next; ListNode *bak = head->next; head->next = runner->next; runner->next = head; head = bak; } return fake.next; }};
0 0
- Insertion Sort List | leetcode
- Leetcode: Insertion Sort List
- [LeetCode] Insertion Sort List
- Leetcode: Insertion Sort List
- leetcode-Insertion Sort List
- [LeetCode]Insertion Sort List
- 【LeetCode】Insertion Sort List
- LeetCode | Insertion Sort List
- LeetCode - Insertion Sort List
- [LeetCode] Insertion Sort List
- Insertion Sort List (LeetCode)
- [LeetCode] Insertion Sort List
- [LeetCode]Insertion Sort List
- leetcode Insertion Sort List
- Insertion Sort List -- LeetCode
- Insertion Sort List (LeetCode)
- LeetCode Insertion Sort List
- leetcode Insertion Sort List
- android 自定义view之(一) Creating a View Class
- iOS开发UI高级—07UIWindow简单介绍
- 认识 Arduino UNO
- 什么是云服务器
- Vi编辑器常用快捷键
- Insertion Sort List -- leetcode
- 【SDUT 3257】Cube Number
- iOS开发UI高级—08控制器的创建
- 什么是云硬盘、云镜像和硬盘快照
- 使用微信支付后调回到自己客户端
- Datazen配置
- iOS开发UI高级—09控制器的View的创建
- 剑指oofer 62 - 序列化二叉树
- 什么是云数据库