剑指Offer——好未来视频面知识点储备+面后总结

情景介绍

  • 时间:2016.10.12 13:00-
  • 地点:宿舍
  • 事件:好未来视频面

知识点储备

数据结构

单链表反转

public class ListNode {
    int val;
    ListNode next = null;

    ListNode(int val) {
        this.val = val;
    }
}
    private static ListNode ReverseList(ListNode head) {
        if (head == null)
            return null;
        ListNode reversedHead = null;
        ListNode current = head;
        ListNode pNext = null;
        ListNode pre = null;
        while (current != null) {
            pNext = current.next;
            current.next = pre;
            if (pNext == null)          // 确定反转后的头结点
                reversedHead = current;
            pre = current;
            current = pNext;
        }
        return reversedHead;
    }

合并两个排序的链表

    /**
     *
     * @param ListNode
     *              链表1
     * @param ListNode
     *              链表2
     * @return ListNode
     *              合并后的链表
     */
    private static ListNode Merge(ListNode list1,ListNode list2) {

        // 其中之一为空或均为空
        if(list1 == null || list2 == null){
            return list1 == null?(list2 == null?list1:list2):list1;
        }else{
            ListNode headNode = null;
            if(list1.val < list2.val){
                headNode = list1;
                headNode.next = Merge(list1.next, list2);
            }else{
                headNode = list2;
                headNode.next = Merge(list1, list2.next);
            }
            return headNode;
        }
    }

求两个链表的第一个公共节点问题

private static ListNode FindFirstCommonNode2(ListNode pHead1, ListNode pHead2) {
        // 第一步首先是特殊输入测试,即为空或长度为0的情况,切记!
        if(pHead1 == null || pHead2 == null){
            return null;
        }
        int len1 = getLength(pHead1);
        int len2 = getLength(pHead2);
        int difLen = 0;
        // pHeadTmp1指向较长链表
        ListNode pHeadLong = pHead1;
        // pHeadTmp2指向较短链表
        ListNode pHeadShort = pHead2;
        if(len1 > len2){
            difLen = len1 - len2;
        }else{
            pHeadLong = pHead2;
            pHeadShort = pHead1;
            difLen = len2 - len1;
        }
        // 1.先让长的链表走difLen步
        for(int i = 0; i < difLen; i++){
            pHeadLong = pHeadLong.next;
        }
        // 2.对齐后,两个链表同时走
        while(pHeadLong != null && pHeadShort != null && pHeadLong != pHeadShort){
            pHeadLong = pHeadLong.next;
            pHeadShort = pHeadShort.next;
        }
        return pHeadLong;
    }

    private static int getLength(ListNode pHead){
        int len = 0;
        while(pHead != null){
            len++;
            pHead = pHead.next;
        }
        return len;
    }

多线程

线程与进程的区别

实现生产者、消费者

package cn.edu.ujn.producer_customer;

// 公共资源类
class PublicResource {

    private static final int MAX_RESOURCE_NUMBER = 10;
    private int number = 0;    

    /**
     * 增加公共资源
     */
    public synchronized void increace() {
        while (number > MAX_RESOURCE_NUMBER) {
            try {
                wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        // 添加资源
        number++;
        System.out.println(number);
        // 进行通知
        notify();
    }    

    /**
     * 减少公共资源
     */
    public synchronized void decreace() {
        while (number == 0) {
            try {
                wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        number--;
        System.out.println(number);
        notify();
    }
}

// 生产者线程,负责生产公共资源
class ProducerThread implements Runnable {
    private PublicResource resource;    

    public ProducerThread(PublicResource resource) {
        this.resource = resource;
    }    

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep((long) (Math.random() * 1000));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            resource.increace();
        }
    }
}    

// 消费者线程,负责消费公共资源
class ConsumerThread implements Runnable {
    private PublicResource resource;    

    public ConsumerThread(PublicResource resource) {
        this.resource = resource;
    }    

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep((long) (Math.random() * 1000));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            resource.decreace();
        }
    }
}    

public class ProducerConsumerTest {
    public static void main(String[] args) {
        PublicResource resource = new PublicResource();
        new Thread(new ProducerThread(resource)).start();
        new Thread(new ConsumerThread(resource)).start();
        new Thread(new ProducerThread(resource)).start();
        new Thread(new ConsumerThread(resource)).start();
        new Thread(new ProducerThread(resource)).start();
        new Thread(new ConsumerThread(resource)).start();
    }
}    

多线程发短信

设计模式

观察者设计模式

单例模式

简单工厂

工厂方法

抽象工厂设计模式

代理设计模式

动态代理设计模式

排序

快排

归并排序

查找

二分查找

存储

堆栈区别

算法

克鲁斯卡尔算法

J2EE

对Spring中IOC、AOP的理解

面后总结

  • 1.数据库索引(聚集索引、组合、主键、普通、唯一)
  • 2.select * from db_name where name=’demo’order by age group by age;执行顺序。
  • 3.提高数据库查询效率的措施。
  • 4.基本数据类型 int、long、short、float、double、char、boolean、byte
  • 5.float与double的区别:精度不同。
  • 6.冒泡排序、快速排序;

  数据库这一块自己是完败!自己只是用了mysql,但是对于里面的概念自己真的表示无能为力!其中数据库索引这一块,其实在项目开发中,自己也没有使用到。惭愧无比!但是简历中明明写了熟悉SQL语句、存储过程和函数(从第二道问题中就完全推翻了自己。)。不能使之成为自己的鸡肋!

 Mysql语法顺序,即当sql中存在下面的关键字时,它们要保持这样的顺序:

  • select[distinct]、from、join(如left join)、on、where、group by、having、union、order by、limit

  Mysql执行顺序,即在执行时sql按照下面的顺序进行执行:

  • from、on、join、where、group by、having、select、distinct、 union、order by

  group by要和聚合函数一起使用,例如:

  • select a.Customer,sum(a.OrderPrice) from orders a where a.Customer=’Bush’ or a.Customer = ‘Adams’ group by a.Customer
  • 数据库+Java是自己找工作的双翼。

  通过面试,还可以发现的问题就是自己的简历中项目过少,导致面试官关于项目的面试中,所问的问题不会太多(这是面试官反映的)。但是,自己感觉也只有“立马送药”这个项目可以拿得出手,其他的项目只可说是练习项目,例如“鲜花礼品网”、“CTCs监测系统”、“竞彩APP”。

  另外,如果视频面的话,最好戴耳麦,否则会很尴尬的。自己当时就没有戴耳麦,结果说话时音调稍不均匀,就会带来很大的噪声与回音,严重影响了面试质量。第一次视频面,姑且作为教训。

  最后可以问面试官问题,最恰当的问题莫过于“请评价一下我此次的视频面,还欠缺哪方面的知识储备,面试结果何时可以给出”。

  最后,自己给自己的面试评分为55。





剑指Offer——好未来视频面知识点储备+面后总结的更多相关文章

  1. 剑指Offer——顺丰笔试题+知识点总结

    剑指Offer--顺丰笔试题+知识点总结 情景回顾 时间:2016.10.16 19:00-20:40 地点:山东省网络环境智能计算技术重点实验室 事件:顺丰笔试 知识点总结 快排 霍尔排序(快排) ...

  2. 剑指Offer——乐视笔试题+知识点总结

    剑指Offer--乐视笔试题+知识点总结 情景回顾 时间:2016.9.19 15:10-17:10 地点:山东省网络环境智能计算技术重点实验室 事件:乐视笔试   总体来说,乐视笔试内容体量不算少, ...

  3. 剑指Offer——携程笔试题+知识点总结

    剑指Offer--携程笔试题+知识点总结 情景回顾 时间:2016.9.17 19:10-21:10 地点:山东省网络环境智能计算技术重点实验室 事件:携程笔试 总体来说,携程笔试内容与其它企业笔试题 ...

  4. 剑指Offer——京东校招笔试题+知识点总结

    剑指Offer--京东校招笔试题+知识点总结 笔试感言 经过一系列的笔试,发觉自己的基础知识还是比较薄弱的,尤其是数据结构和网络,还有操作系统.工作量还是很大的.做到精确制导的好方法就是在网上刷题,包 ...

  5. 剑指Offer - 九度1367 - 二叉搜索树的后序遍历序列

    剑指Offer - 九度1367 - 二叉搜索树的后序遍历序列2013-11-23 03:16 题目描述: 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果.如果是则输出Yes,否则输出 ...

  6. 剑指Offer——CVTE校招笔试题+知识点总结(Java岗)

    剑指Offer(Java岗)--CVTE校招笔试题+知识点总结 2016.9.3 19:00参加CVTE笔试,笔试内容如下: 需要掌握的知识:Linux基本命令.网络协议.数据库.数据结构. 选择题 ...

  7. 剑指Offer:面试题24——二叉搜索树的后序遍历序列(java实现)

    问题描述: 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果.如果是则返回true,否则返回false.假设输入的数组的任意两个数字都互不相同. 思路: 1.首先后序遍历的结果是[(左子 ...

  8. 剑指offer(23)二叉搜索树的后序遍历序列

    题目描述 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果.如果是则输出Yes,否则输出No.假设输入的数组的任意两个数字都互不相同. 题目分析 1.后续遍历我们可以知道,最右边的是根节 ...

  9. 剑指offer编程题Java实现——面试题4后的相关题目

    题目描述: 有两个排序的数字A1和A2,内存在A1的末尾有足够多的空余空间容纳A2.请实现一个函数,把A2中的所有数字插入到A1中并且所有的数字是排序的. 还是利用从后向前比较两个数组中的数字的方式来 ...

随机推荐

  1. mysql 免安装与 忘记root密码 密码过期

    免安装: 参考 :https://blog.csdn.net/werwqerwerwer/article/details/52919939 注:别忘了配置环境变量   忘记root密码解决办法: 1. ...

  2. Struts2--拦截器Interceptor

    拦截器是的我们可以在方法的执行前后定义执行的操作.可以作为一个非常有力的工具在数据验证,属性设置,安全,日志等等方面. 拦截器可以链接起来形成一个拦截器栈.框架会按照拦截器定义的顺序依次调用这些拦截器 ...

  3. [Luogu 3901]Difference

    Description Input Output Sample Input 4 2 1 2 3 2 1 3 2 4 Sample Output Yes No HINT 题解 莫队.加个标记数组维护该数 ...

  4. POJ2449 Remmarguts' Date

    "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. ...

  5. 51 nod 1681 公共祖先 (主席树+dfs序)

    1681 公共祖先 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题   有一个庞大的家族,共n人.已知这n个人的祖辈关系正好形成树形结构(即父亲向儿子连边). 在另 ...

  6. hdu 3939(勾股+容斥)

    题意: 给定一个整数L(L<=1e12),计算(x,y,z)组的个数.其中x<y<z,x^2+y^2=z^2,gcd(x,y)==1,gcd(x,z)==1,gcd(y,z)==1. ...

  7. linux最常用的基本命令

    //**********************对应linux centos常用命令 **************************/// 安装centos6.6带有gnome桌面 ctrl+c ...

  8. Linux必备操作vim

    vim被称作为编辑器之神,那么在我们操作linux系统时,进行编辑操作有没有感觉心有余而力不足?今天我讲自己总结的一些vim的操作命令和大家进行一下分享,有不足之处还请指出. vim的三种模式大家还记 ...

  9. Linux系统之TroubleShooting(故障排除)(转)

    尽管Linux系统非常强大,稳定,但是我们在使用过程当中,如果人为操作不当,仍然会影响系统,甚至可能使得系统无法开机,无法运行服务等等各种问题.那么这篇博文就总结一下一些常见的故障排除方法,但是不可能 ...

  10. 修改hosts不必重启 立刻生效

    打开命令提示符窗口执行以下命令: 显示DNS缓存内容 ipconfig /displaydns 删除DNS缓存内容 ipconfig /flushdns ps.电脑卡的话,先关机再开机(别直接重启)