自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 资源 (1)
  • 收藏
  • 关注

原创 Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.For example, Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1 \ 2 \ 3

2017-02-28 22:55:45 473

原创 Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNo

2017-02-28 22:19:44 356

原创 Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list./** * Definition for singly-linked lis

2017-02-28 20:51:29 318

原创 Insertion Sort List

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;

2017-02-28 15:19:01 299

原创 Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes’ values.For example, Given {1,2,3,4}, reorder it to {1,4,2,3}

2017-02-28 14:33:46 346

原创 Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up: Can you solve it without using extra space?class Solution

2017-02-28 10:42:13 243

原创 Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in plac

2017-02-28 09:21:46 262

原创 Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked list be

2017-02-28 09:17:11 270

原创 Reverse Linked List II

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 = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the following co

2017-02-25 18:13:04 238

原创 Palindrome Linked List(回文链表)

LintCode原题 Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?class Solution {public: bool isPalindrome(ListNode* head) {

2017-02-25 11:26:21 372

原创 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 the original relative order of the nodes in each of the

2017-02-25 11:12:01 230

原创 Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2017-02-24 10:50:57 253

原创 Reverse Linked List

Reverse a singly linked list.原题/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solut

2017-02-23 20:47:39 305

原创 Linked List Cycle

Given a linked list, determine if it has a cycle in it. * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {}

2017-02-23 20:27:12 248

原创 Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.class Solution {public: ListNode* mergeKLists(vector<ListNode*>& lists) { if(lists.size()==

2017-02-23 20:20:12 317

原创 Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists./** * Definition for singly-linked list. * struct ListNode

2017-02-23 19:49:39 236

原创 LeetCode(M) Sort List

Sort a linked list in O(n log n) time using constant space complexity.根据题目O(nlogn)时间,O(1)空间,选择了归并排序/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next;

2017-02-23 19:47:44 223

原创 LeetCode(M) Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2

2017-02-23 11:12:43 305

原创 LeetCode(E) Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3.最初我的代码ListNode *deleteDuplicates

2017-02-23 10:57:14 266

原创 LeetCode(M)threesum

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain duplic

2017-02-22 18:37:05 920

操作系统进程管理

里面包含操作系统的进程管理实验,里面含有核心代码以及实验心得等

2015-12-12

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除