Linked-list
minGW_Lee
I don't know, Just do it!
展开
-
Linked list 总结
单链表总结:首先就是指针的问题,就算new出新指针tmp做临时变量,对tmp的改变会同时改掉原指针,因为它们本身指向同一内存地址。所以对链表的操作,一定要注意指针的操作顺序。对链表的逆序,注意添加头结点,会是操作方便很多nlogn的排序有快速排序、归并排序、堆排序。 双向链表用快排比较适合,堆排序也可以用于链表,单向链表适合用归并排序技巧:添加头指针,再进行操作,更加方便。使用快慢指针原创 2017-03-17 20:02:01 · 264 阅读 · 0 评论 -
138. 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. Subscribe to see which companie原创 2017-03-22 22:32:06 · 184 阅读 · 0 评论 -
leetcode 4:median-of-two-sorted-arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).难点:需要在O(log (m+n))内完成。//采用数组合并的思想,然后取原创 2017-03-25 10:10:00 · 200 阅读 · 0 评论 -
leetcode92. 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原创 2017-03-17 13:50:17 · 218 阅读 · 0 评论