LeetCode——Insertion Sort List
来源:互联网 发布:淘宝女服装 编辑:程序博客网 时间:2024/06/03 21:13
Sort a linked list using insertion sort.
原题链接:https://oj.leetcode.com/problems/insertion-sort-list/
题目:用插入排序对一个链表排序。
public ListNode insertionSortList(ListNode head) {ListNode newHead = new ListNode(-1);ListNode pre = newHead;ListNode current = head;while(current != null){pre = newHead;while(pre.next != null && pre.next.val < current.val)pre = pre.next;ListNode next = current.next;current.next = pre.next;pre.next = current;current = next;}return newHead.next;}
0 0
- LeetCode—Insertion Sort List
- LeetCode——Insertion Sort List
- LeetCode——Insertion Sort List
- leetcode 147 —— Insertion Sort List
- Insertion Sort List —— Leetcode
- LeetCode—Insertion Sort List 解题报告
- LeetCode—147 Insertion Sort List
- 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)
- (韩顺平讲解)jdbc学习(三)---mysql的CRUD操作
- microsoft visual studio 2010 build 时提示:“failure during conversion to COFF: file invalid or corrupt ”
- 近期遇到的狗血事以及反思
- (韩顺平讲解)jdbc学习(四)---java连接mysql
- js {} []
- LeetCode——Insertion Sort List
- 背包问题九讲笔记_01背包
- 抓取华夏安全新闻并存入mysql
- java 实现万年历
- 复数运算
- 【2014 Multi-University Training Contest 6】 G. Series 1(n阶差分,组合数,大数)
- 【转移通知】博客停用通知
- 初等数学导论:传球游戏
- Windows上面编译和简单测试一下leveldb