LeetCode-Insertion Sort List
来源:互联网 发布:崩坏3rd初始号淘宝 编辑:程序博客网 时间:2024/06/10 14:21
记清insertion sort 的方法
然后就是dummy!!!
public class Solution { public ListNode insertionSortList(ListNode head) { if ( head == null || head.next == null ) return head; ListNode temp = head; ListNode dummy = new ListNode(0); dummy.next = head; while ( temp.next != null ){ ListNode cur = temp.next; if ( temp.val > temp.next.val){ ListNode node = dummy.next; ListNode pre = dummy; while ( node.val <= cur.val ){ node = node.next; pre = pre.next; } temp.next = cur.next; cur.next = node; pre.next = cur; } else temp = temp.next; } return dummy.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 Studio提交项目到github的几个问题
- OpenStack Kilo VirtualBox CentOS7 部署问题汇总及解决办法
- JAVA两窗体之间的传值
- Xcode7 导出企业级(大企业)安装包ipa
- GLib 创建自定义事件源
- LeetCode-Insertion Sort List
- Training ------ Building Your First App ------ Building Your First App
- C#RichTextBox更改字体(Font)[大小,粗/斜/下划/删除,变色]
- tar 解压缩命令详解
- Word Ladder II(BFS + DFS)
- 蓝的成长记——追逐DBA(20):何故缘起,建库护航
- *LeetCode-Kth Largest Element in an Array
- 在线图片处理工具集合
- OpenCV中feature2D学习——ORB和BruteForceMatcher