138. Copy List with Random Pointer

//不从head走 前面加一个dummy node 从dummy走先连head 只需记录当前节点
//这样就不需要考虑是先new node还是先找联系
//扫两遍 先建立节点和next 利用map<node*, node*>old2new 来找random

linked list 一般用while循环来建立loop

147. Insertion Sort List

//这里dummy是新插入的sorted list的头,所有节点要往其后插
//curr是插入位置的前一个节点

//从头往后扫 要记住next 以便作为下次比较的head

148. Sort List

要求O(nlogn) 用merge排序 因为quicksort不好access list的data

160. Intersection of Two Linked Lists

先判断没有交叉的情况
判断有交叉 用length差从头结点往后数 确保两条list当前node与首交node距离相等
通用判断while(headA != headB)往后走

Linked List - leetcode的更多相关文章

  1. Palindrome Linked List leetcode

    Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time ...

  2. Flatten Binary Tree to Linked List [LeetCode]

    Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 T ...

  3. Flatten Binary Tree to Linked List (LeetCode #114 Medium)(LintCode #453 Easy)

    114. Flatten Binary Tree to Linked List (Medium) 453. Flatten Binary Tree to Linked List (Easy) 解法1: ...

  4. Flatten Binary Tree to Linked List ——LeetCode

    Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 T ...

  5. Delete Node in a Linked List leetcode

    Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...

  6. Flatten Binary Tree to Linked List leetcode java

    题目: Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 ...

  7. Plus One Linked List -- LeetCode

    Given a non-negative number represented as a singly linked list of digits, plus one to the number. T ...

  8. 876. Middle of the Linked List - LeetCode

    Question 876. Middle of the Linked List Solution 题目大意:求链表的中间节点 思路:构造两个节点,遍历链接,一个每次走一步,另一个每次走两步,一个遍历完 ...

  9. 206. Reverse Linked List - LeetCode

    Question 206. Reverse Linked List Solution 题目大意:对一个链表进行反转 思路: Java实现: public ListNode reverseList(Li ...

随机推荐

  1. SZU:B47 Big Integer II

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Normal Descrip ...

  2. Mac 下卸载 Graphviz

    打算安装这个程序,但是听说这个软件在 Mac 上有问题,所以先记录下卸载方法. 方法一: 双击 pkg 文件后,当看到安装器界面时: 按 Command + i 打开安装包的信息窗口: 展开后可以看到 ...

  3. macvim打造python IDE

    昨天安装了macvim,今天在上面配置了一下python的ide: 大家也可参考http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/ 1.文法 ...

  4. Changing the working directory of VIM

    Sometimes we want to open another file in the same folder with current editing file, what we can do ...

  5. 利用pdf2swf将PDF转换成SWF

    将PDF转换成SWF可以使用SWFTools工具中的pdf2swf(http://www.swftools.org/),CSDN快速免积分下载地址http://download.csdn.net/de ...

  6. 刨根问底儿 -- intVal($str) 跟 (int) $str 的运算结果有什么区别

    intVal($str) 跟 (int) $str 都是把其他类型的变量转化为int型变量的方式,这么多年来我一直森森滴怀疑它们的运算结果在某些条件下会有区别.对于我的疑问,文档里也没有多说(或者我没 ...

  7. 用docker cluster store实现kuryr的共享subnet

    kuryr共享网络 在上一篇分享中,提到共享网络需要在10.8.65.80和10.8.65.81上分别通过docker network create来创建网络.而实际上,通过对docker源码的解读, ...

  8. 如何实现自己的ClassLoader

    摘自深入分析java web技术内幕

  9. Web 请求响应原理(转)

    用Java实现Web服务器 减小字体 增大字体 摘要:WWW的工作基于客户机/服务器计算模型,由Web 浏览器(客户机)和Web服务器(服务器)构成,两者之间采用超文本传送协议(HTTP)进行通信,H ...

  10. 关于ABP——领域服务的思考

    我在刚接触ABP的时候一直有一个疑问--有了应用服务,为什么还需要领域服务呢? 领域服务和应用服务对比 领域服务 应用服务 返回值 Entity DTO 被表现层调用 不可以(非强制) 可以 在ABP ...