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. Visual Studio 2013发布Cloud Service至Azure China

    Visual Studio 2013发布Cloud Service至Azure China <Windows Azure Platform 系列文章目录> 之前有很多网友询问我如何通过VS ...

  2. linux时间校准设置,解决与本地时间不一致问题

    时间安装脚本   从NTP上把时间同步到本地 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 更新本地时间 ntpdate us.pool.nt ...

  3. 自定义表单-jsonform

    项目文件地址:https://github.com/powmedia/backbone-forms#editor-list DEOM:http://jsfiddle.net/evilcelery/dW ...

  4. Apache Rewrite 中文详解

    这几天一直在研究Apache的重写规则,虽然网上有很多教程,不过发现大部分都是抄袭一个人的,一点都不全,所以我想写一个简单的易于理解的教程,我学习.htaccess是从目录保护开始的,这个也比较简单, ...

  5. IOS使用不同父类的 view 进行约束

    最终效果图如下: 很多限制条件都已经应用到了视图中,我们在解释一下: ·在我们的视图控制器的主视图中有两个灰色的视图.两个视图距视图控制器的视图左 边和右边都有一个标准的空白距离.视图的顶部距顶部的视 ...

  6. 记一次bug查找经历

    系统采用cell插件显示汇总数据,然后发现个公司数据显示不出来,接到这个任务开始查找bug. 通过需求了解并不知道其他公司什么情况,因为就这个公司有了反馈: 本来以为很容易找到点的,毕竟数据显示不出来 ...

  7. iOS 动画类型 笔记

    #pragma mark Core Animation - (IBAction)buttonPressed1:(id)sender { UIButton *button = (UIButton *)s ...

  8. Android Chronometer控件使用,计时器

    Android Chronometer实现了一个简单的计时器,继承自TextView,因此可以使用TextView的text控制属性来控制时间显示的颜色.字体大小等:可以定义时间显示格式,默认“MM: ...

  9. PHP:获取指定日期所在月的开始日期与结束日期

    /** * 获取指定日期所在月的开始日期与结束日期 * @param string $date * @param boolean 为true返回开始日期,否则返回结束日期 * @return arra ...

  10. VB.NET调用SQL Sever存储过程

    概要: 本文介绍VB.NET使用创建并调用带有输入参数和输出参数的SQL Sever存储过程 本文代码首先检查要创建的存储过程再数据库中是否存在在.如果不存在,则代码创建一个存储过程,该过程一个参数来 ...