Google Zhejiang University Recruitment pen test brother can only help you here, google Zhejiang University

Source: Internet
Author: User

Google Zhejiang University Recruitment pen test brother can only help you here, google Zhejiang University

Google Zhejiang University Recruitment questions
I. single answer
1. In 80x86, the decimal number-3 is expressed as a 16-bit binary number? 0010000
2. Assume that the symbols-, *, and $ represent subtraction, multiplication, and exponential Operations respectively, and
1) the priority order of the three operators is-highest, * Second, and $ lowest;
2) The operator is left-aligned during operation. Calculate the value of 3-2*4 $1*2 $3:
(A) 4096, (B)-61, (C) 64, (D)-80, (E) 512
Operator
3. In the following pseudocode, the parameter is passed by reference and the result is?
Calc (double p, double q, double r) {q = q-1.0; r = r + p}
Main (){
Double a = 2.5, B = 9.0;
Calc (B-a, a, );
Print ();
}
(A) 1.5 (B) 2.5 (C) 10.5 (D) 8 (E) 6.5
4. output result:
Int foo (int x, int y ){
If (x <= 0 | y <= 0) return 1;
Return 3 * foo (x-1, y/2 );
}
Printf ("% d \ n", foo (3, 5 ));
(A) 81 (B) 27 (C) 9 (D) 3 (E) 1
5. Which of the following data structures is most widely used in Priority Queues? A
(A) heap (B) array (C) bidirectional linked list (D) graph (E) vector
6. The following algorithm describes a method for finding the k element (k> = 1 and k <= n) in the two-way linked list of n elements ):
If k <= n-k, the K-1 elements start from the linked list.
Otherwise, start from the end and go back to n-k elements.
What is the time cost of this algorithm?
(A) θ (nlogn) (B) θ (max {k, n-k}) (C) θ (k + (n-k ))
(D) θ (max {k, k-n}) (E) θ (min {k, n-k })
7. How many edges does a graph contain ten vertices and each vertex has six degrees? 30
(A) 60 (B) 30 (C) 20 (D) 80 (E) 90
8. Regular Expression L = x * (x | yx + ). Which of the following strings is not signed?
(A) x (B) xyxyx (C) xyx (D) yxx (E) yx
9. The total time required to prepare a disk drive for reading a piece of data includes
(A) waiting time (B) seeking time (C) transmission time (D) Waiting Time plus seeking time (E) Waiting Time plus seeking time plus transmission time
Ii. Algorithms
1. Print the content of a binary tree.
2. Find the first character that appears only once in a string. For example, abaccdeff, output B.
3. Given an integer array whose length is N (the element has positive and negative values), find a subarray with the largest sum of all elements. Analyzes the algorithm's time-space complexity. You do not need to write code.

The following is a reference for the dynamic planning of algorithm question 3rd:
Maximum subsequence
Problem:
Given An integer sequence A1, A2,... An (which may be negative), evaluate A1 ~ An sub-sequence of Ai ~ Aj makes the sum of Ai to Aj the largest
For example, the sum of the largest subsequences-2, 11,-4, 13,-5, 2,-5,-3, 12,-9 is 20. The simplest and easiest way to think about this is to enumerate all subsequences. Use a triple loop to obtain the sum of all subsequences in sequence and then obtain the largest one. Of course, the algorithm complexity will reach O (n ^ 3 ). Obviously, this method is not optimal. The following shows a linear algorithm implementation with an algorithm complexity of O (n). The algorithm comes from Programming Pearls. Before providing a linear algorithm, let's look at an algorithm optimized for the exhaustive algorithm. Its complexity is O (n ^ 2 ). In fact, this algorithm only makes some changes to the exhaustive algorithm: in fact, we do not need to re-calculate the subsequence every time. Assume that Sum (I, j) is A [I]... sum (I, j + 1) = Sum (I, j) + A [j + 1]. With this recursion, we can obtain the following algorithm:
Int max_sub (int a [], int size)
{
Int I, j, v, max = a [0];
For (I = 0; I <size; I ++)
{
V = 0;
For (j = I; j <size; j ++)
{
V = v + a [j]; // Sum (I, j + 1) = Sum (I, j) + A [j + 1]
If (v> max)
Max = v;
}
}
Return max;
} How can we achieve linear complexity? Here we use the idea of dynamic planning. Let's take a look at the source code implementation:
Int max_sub2 (int a [], int size)
{
Int I, max = 0, temp_sum = 0;
For (I = 0; I <size; I ++)
{
Temp_sum + = a [I];
If (temp_sum> max)
Max = temp_sum;
Else if (temp_sum <0)
Temp_sum = 0;
}
Return max;
}

In this scanning array, the sum of the current sub-sequence and temp_sum are recorded from left to right. If this sum increases, so the maximum subsequence and max are also constantly increasing (updating max ). If a negative number is encountered in the forward scan, the sum of the current subsequence is reduced. In this case, temp_sum will be smaller than max, and max will not be updated. If temp_sum is reduced to 0, the segment that has been scanned before can be discarded. In this case, temp_sum is set to 0. Then, temp_sum analyzes the child segment from the end. If there is a child segment larger than the current max, update max. The scanning result is displayed.


Google interview question Summary
Test Questions: 9 single answer + 3 Q & A Questions
Time: 100 minutes
I am doing B.
Single answer:
1. Find the difference or value of two binary numbers. People who have basically learned something from a computer can answer the same question ..
2. Don't remember .. It is also a question that does not need to be considered ..
3. It is probably the following function:
Int someFunc (int x ){
If (x = 0)
Return 0;
Else
Return x + someFunc (x-1 );
}
Ask what this calculation is...
4. Don't remember .. You don't need to think about it ..
5. Don't remember .. You don't need to think about it ..
6. See 2, 4, 5 ..
7. It seems that you need to think about it ..
8. Ask which of the advantages of the linked list structure and array are not included,
Including:
Insert time
Time deleted
Storage space
The remaining two do not remember ..
9. the following functions:
T (x) = 1 (x <= 1)
T (n) = 25 T (n/5) + n ^ 2
Question T (n) increases with n.
The options are as follows:
O (n ^ 2), O (n ^ 2 logn), and so on ..
Q &:
1. Write the multiplication of two N * N matrices and give the C format. You can select your preferred language for writing ..
Int * multi (int * a1, int * a2, int N ){
}
2. Search for the item in a one-way linked list. If two items exist, the first one is returned. The format of C is given. You can also choose ....
Struct {
Node * next;
Int value;
} Node;
Node * someFunc (Node * head ){
}
3. For an integer array with a length of n, only multiplication is allowed. Division is not allowed to calculate the largest group in the product of any (n-1) number... Write out the time-space complexity of the algorithm.
Ps: I suspect that this question has failed .. Even though I have done something wrong ......
Some Supplements:
1. The first question of a question is the original question of google's intern last semester;
2. google enjoys the linked list. No matter intern's interview or two written examinations, there are such questions;
3. google generally focuses on the time-space complexity of algorithm writing;
4. multiple-choice questions are basically simple, but it does not seem that easy to achieve high accuracy;
5. According to rumors, gossip, cloud, and instant messaging, google's high-speed review policy comes from multiple-choice questions during review. If you're all right, congratulations; if you have made several mistakes, try again. If there is another time... Big questions are basically for reference...


Google pen question 2006
Multiple choice questions
1. Set the maximum value of a unsigned 16-digit integer a to 1.
2. Fibonacci, evaluate f (4) the number of times f (1) is called recursively f (n) = f (n-1) + f (n-2)
F (0) = 0, f (1) = 1
A.5 B .4 C.3 D.4 or above
3. if (xAS {print "1 ″}
S-> AB {print "2 ″}
A-> a {print "3 ″}
B-> bC {print "4 ″}
B-> dB {print "5 ″}
C-> c {print "6 ″}
6. correct statement about the hash table (indefinite)
A. Hash Table efficiency and hash functions .... Related
B. The solution to hash table conflicts is slow. Returning affects the hash table efficiency.
C. Use the linked list hash to compact the memory
7. a hunger-free scheduling method is as follows:
A. Scheduling
B.
C. shortest time
D. Latest queue
8. Which of the following sorting methods has the worst time complexity of O (n ^ 2:
A. insert
B. Merge
C. Bubble
D. Fast
Programming questions:
1. Calculate the height of a binary tree. if there is only a root node, the height is 0.
2. Extract non-zero elements from the sparse group and use the linked list
3. Two n-dimensional arrays, sorted in ascending order. The design algorithm is used to calculate the 2n number.
N. Analysis of Time and Space complexity is required. No code

========================================================== ======================================

This is part of google's interview questions. Hope you will be lucky later.
1. Find the maximum inner rectangle of the histogram. Suppose the width of each slice is 1. This question is very hot. Two people asked me. I didn't come up with any good algorithms.

2. Search for a number in an ordered matrix of NxN rows and columns. Someone has encountered the time complexity of. O (N) before.

3. Given an article, calculate the time complexity of the shortest digest. O (N) containing all words.

4. Converting the matrix of MxN to rank requires the space complexity of O (1). Refer to cyclic group and group generator in group theory.

5. Open Question: How to avoid repeated webpage capturing

6. Open Question: some websites only allow limited access every day. How can we capture webpages to make the indexes as comprehensive and fresh as possible?

7. Example of writing a singleton pattern

8. vector vs. arraylist, growth strategy & complexity

9. In the C ++ file, only declare class A is used, but define class A is not used in any way.

10. virtual function

11. Discuss html vs. xhtml vs. xml

12. describe what happened after a URL is typed in the browser. dns, cache, etc.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.