原文:Partition List leetcode java

题目: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each ...

2014-07-23 10:21 0 3863 推荐指数:

查看详情

Leetcode: Partition List

思路: 1. 空间复杂度为 o(n) 解法. 创建两个链表, 分别记录大于 x 和小于 x 的节点, 最后合并 2. o(1) 的空间复杂度解法. 四个指针, 分别指向小于 x 部分链表的头, 尾 ...

Fri Dec 06 01:20:00 CST 2013 0 2432
[leetcode]Partition List @ Python

原题地址:https://oj.leetcode.com/problems/partition-list/ 题意: Given a linked list and a value x, partition it such that all nodes less than x come ...

Thu Jun 12 17:38:00 CST 2014 0 2671
[LeetCode] Partition List 划分链表

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve ...

Sun Mar 08 16:37:00 CST 2015 0 11175
Rotate List leetcode java

题目: Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k ...

Thu Jul 24 08:54:00 CST 2014 0 4560
Sort List leetcode java

题目: Sort a linked list in O(n log n) time using constant space complexity. 题解: 考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到 ...

Sat Jul 26 10:51:00 CST 2014 0 4210
Insertion Sort List Leetcode java

题目: Sort a linked list using insertion sort. 题解: Insertion Sort就是把一个一个元素往已排好序的list中插入的过程。 初始时,sorted list是空,把一个元素插入sorted list中。然后,在每一次插入过程中,都是 ...

Wed Jul 23 18:45:00 CST 2014 1 4336
Reverse Linked List II leetcode java

题目: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m ...

Thu Jul 24 07:37:00 CST 2014 0 2573
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM