Alibaba 2013 Questions algorithm/research and development post

Source: Internet
Author: User
Tags execution variables

1.-7 of binary complement (D)

(1)-7 of the original code 1000 0111

(2) sign bit unchanged 1000 0111

(3) The numeric position of the counter 1111 1000

(4) plus 1 1111 1001

Attention:

(1) The complement of the positive integer is the same as the original code

(2) The complement is converted to the original code

The symbol bit of the complement is ' 0 ', the original code on the complement

The symbol bit of the complement is ' 1 ', the original code is the complement of the complement

2. Four kinds of media, maximum bandwidth: (C)

A Coaxial cable B twisted pair C fiber D sync Line

Note:

(1) Twisted pair, also known as Double Twist, is the oldest but most commonly used transmission media. The two copper wires insulated with each other are emitted together and then twisted in a regular way (this is done to reduce the electromagnetic interference of adjacent conductors) and constitute twisted pair.

Twisted-pair line is divided into 1 classes to 5 categories, the local area network commonly used for 3 categories, 4 and 5 types of twisted pair. 3-Class line for voice transmission and the highest transmission rate of 10Mbps data transmission; 4-class line for voice transmission and the highest transmission rate of 16Mbps data transmission; 5 class line for voice transmission and data transmission with the highest transmission rate of 100Mbps

(2) The coaxial cable is composed of the inner conductor copper core wire, the insulating layer, the net-formed outer conductor shielding layer and the protective plastic outer part, and the inner conductor and the outer conductor constitute a set of line pairs. Because of the role of the outer conductor shielding layer, coaxial cable has good anti-interference resistance.

Coaxial cable can transmit the 10MB/S baseband digital signal 1-kilometer to 1.2 km, so it is widely used in LAN

(3) Optical fiber communication is the use of optical fiber transmission of light pulses to communicate, and optical fiber is the media of optical communication. Optical fiber at any time can only be one-way transmission, therefore, to implement two-way communication, it must be in pairs, one for input, one for output, fiber ends to the optical interface.

The transmission system of optical fiber is much larger than coaxial cable, the maximum transmission bandwidth of general small coaxial cable is about 20MHz, and the maximum transmission bandwidth of coaxial cable is about 60MHz. The data transmission rate of a single optical fiber can reach several Gbps, and the transmission distance can reach dozens of kilometers without the use of repeater.

3. Process blocking reason (A)

A. Time slice switch B. Waiting for I/O C. Process sleep D. Waiting to unlock

If there is no time slice rotation, then the process can not switch, a process will be exclusive CPU. However, you cannot say that a time slice switch causes a process to block.

Note:

(1) The process, the concept is mainly two points:

First, the process is an entity. Each process has its own address space, typically including the text area (region), the data region (region), and the stack region.

The text area stores the code that the processor executes;

The data region stores variables and dynamically allocated memory used during process execution;

The stack area stores the instructions and local variables that are invoked by the active procedure.

Second, the process is a "program in progress". A program is a lifeless entity, and only the processor gives the program life, it becomes an active entity, which we call the process.

(2) Three basic states of the process

The process continuously changes its running state during operation. Typically, a running process must have the following three basic states.

Ready (Ready) state when a process has been allocated to all the necessary resources except the CPU, the process state is called a ready state as long as the processor is available for immediate execution.

Execution (Running) state when a process has acquired a processor, its program is executing on the processor, and the status of the process is called the execution state.

A process that is being executed by a blocking (Blocked) state that discards the processor and is blocked because it cannot be executed while waiting for an event to occur. There are a number of events that cause the process to block, such as waiting for I/O completion, request buffer not being satisfied, waiting for a letter (signal), and so on.

Transitions between three states of a process

When a process is running, it is constantly transitioning from one state to another, and it can be in the ready state and execution state several times, and can be blocked multiple times. Figure 3_4 describes the three basic states of the process and their transformations.

(1) Ready → Execute the process in a ready state, and when the process Scheduler assigns a processor to it, the process is transformed from the ready state to the execution state.

(2) Execution-ready the process in which execution is performed, the process is turned from execution state to ready state because a time slice allocated to it has been exhausted.

(3) execution → blocking the executing process becomes blocked from the execution state because it waits for an event to occur and cannot continue.

(4) blocking → Ready to be in a blocking state of the process, if its waiting event has occurred, so the process from the blocking state into a ready state.

A few introductions about the process http://oa.gdut.edu.cn/os/multimedia/oscai/chapter2/pages/ch22.htm# page header

4. Set only the root node of the two-tree height of 1, the existing one height of H (h>1) two fork tree is only 0 and out of the degree of 2 nodes, then this binary tree node is at least:

A.2^h-1 b.2h-1 c.2h d.2h+1

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

Take h=1, you can exclude C and D.

There is a clever way: directly to take h=3, drawing a look, obviously is 5, so the answer is B.

Here's what to analyze: If each node is 0 or 2, then either you are the leaf or you have a son. So what happens when the nodes are the least? Go straight down a road and keep the degree 2 until the height reaches H, then the total number of nodes: 2h-1.

5. Given the following program, then execute printf ("%d\n", foo (20,13)) and the result is:

int foo (int x,int y)

{

if (x <= 0 | | y <= 0) return 1;

Return 3*foo (X-6,Y/2);

}

A.3 b.9 c.27 d.81

Solution: Foo (20,13)->3*foo (14,6)->9*foo (8,3)->27*foo (2,1)->81foo ( -4,0) =81

6. The following statements are incorrect:

A.dijkstra is the shortest path between two points, the complexity of: O (n^2).

B.floyd-warshall is the shortest path between all point pairs, the complexity of: O (n^3).

C. The minimum degree of complexity for the N-number is: O (N*LOGN).

D. The lower bound of the complexity of the ranking algorithm based on comparison is: O (N*LOGN).

Note:

(1) Dijkstra

Http://jpkc.xaau.edu.cn/sjjg/datastru/zxxx/View/6.5.html

Http://jpkc.xaau.edu.cn/sjjg/datastru/zxxx/six%20lesson/642.html

An algorithm that produces the shortest path in order of ascending path length.

The basic idea of the algorithm is:

Sets S and t=v-s of two vertices, set S holds vertices that have found the shortest path, and the set T holds vertices of the shortest path that are not currently found. Initial state, the set S contains only the source point V0, and then continuously selects the vertex u from the set T to the vertex v0 path with the shortest length is added to the set S, and every new vertex U is added to the set S to modify the shortest path length value of the vertex v0 to the remaining vertices in the set T. The new shortest path length values for each vertex in set T are the original shortest path length value and the shortest path length value of the vertex u plus the smaller value in the path length value of U to the vertex. This process repeats until the vertices of the set T are all added to S.

Pseudo code:

1 function Dijkstra (G, W, s)

2 for each vertex v in v[g]//initialization

3 D[v]: = Infinity

4 Previous[v]: = undefined

5 D[s]: = 0

6 S: = Empty Set

7 Q: = Set of all vertices

8 while Q are not a empty set//Dijstra algorithm Principal

9 U: = Extract_min (Q)

Ten s: = S Union {u}

For each edge (u,v) outgoing from U

If D[V] > D[u] + w (u,v)//expand Edge (U,V)

D[V]: = D[u] + w (u,v)

PREVIOUS[V]: = u

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.