当前位置 博文首页 > derek880731的专栏:阿里巴巴 2014校招 研发工程师 笔试

    derek880731的专栏:阿里巴巴 2014校招 研发工程师 笔试

    作者:[db:作者] 时间:2021-06-10 15:09

    刚杭州这边阿里巴巴校招笔试回来

    回忆一下题,为大家将来的笔试做点准备

    选择题:

    1.字符串“alibaba” 的huffman编码有几位

    2.以下哪些用到贪婪算法:

    • 最小生成树的Prim算法
    • 最小生成树的Kruskal算法
    • Floyd-Warshall算法
    • Dijkstra算法
    • KMP算法

    3.一棵二叉树,度数为2的节点8个,度数为1的节点5个,问度数为0的节点多少个

    4.流水线吞吐率问题

    填空题:

    1.循环队列,有front,rear指针,N为队列长度,求循环队列的实际长度?

    2.一个数组,只扫一遍,如何算出方差

    3.两个int,不用临时变量,用3行代码来交换他们的值

    Java选做题:

    问下面代码的输出:

    public class Test1 {
    
    	public static int k = 0;
    	public static Test1 t1 = new Test1("t1");
    	public static Test1 t2 = new Test1("t2");
    	public static int i = print("i");
    	public static int n = 99;
    	public int j = print("j");
    	{
    		System.out.println("实例块");
    	}
    	static {
    		System.out.println("静态块");
    	}
    	
    	public Test1(String str) {
    		System.out.println((++k) + ":" + str + "    i="+i+ "    n="+n);
    		++i;
    		++n;
    	}
    	
    	public static int print(String str) {
    		System.out.println((++k) + ":" + str + "    i="+i+ "    n="+n);
    		++n;
    		return ++i;
    	}
    	public static void main(String[] args) {
    		Test1 t = new Test1("init");
    	}
    }

    希望大家补充!!