Baidu software development (Shanghai site)

Source: Internet
Author: User

Software Development (Shanghai)

Short answer

  1. Describes the layer-7 structure of OSI (Basic Reference Model for interconnection of Open Systems:

Layer 7: the application layer provides services directly to the application. The application can be changed, but it must include the transmission of electronic messages from the user;

Layer 6: presentation layer, formatting data to provide common interfaces for applications, which can include the encryption service

Layer 5: Session Layer: establishes an end connection between two nodes. This service includes setting up connections in full or half duplex mode, although the duplex mode can be processed in Layer 4.

Layer 4: transport layer, standard data delivery, connection oriented or connectionless. Includes full or half duplex, traffic control, and error recovery services

Layer 3: network layer, which establishes a connection between two nodes through addressing. It includes routing and relay data through the Internet.

Layer 2: data link layer, which divides data frames and processes stream control. This layer specifies the topology and provides hardware addressing.

Layer 1: physical layer, original bit stream transmission, electronic signal transmission, and hardware interfaces

Data is sent from the seventh layer to the first layer, while the receiver is the opposite.

The upper layer is called the application layer, which is used to control software.

The lower layer is called the data stream layer to manage hardware.

Data is split when it is sent to the data stream layer.

The data in the transmission layer is called a segment. The network layer is called a packet. The data link layer is called a frame. The physical layer is called a bit stream. This is called a PDU (Protocol Data Unit)

  1. Write data sharing between processes, at least three

1) map files through shared memory

2) use the shared memory DLL

3) Send the wm_copydata message to another process

4) Call the readprocessmemory and writeprocessmemory functions. You can send the extracted handle by the globallock (gmem_share,...) function call, the pointer returned by the globallock function, and the pointer returned by the virtualalloc function.

  1. Describes the Differences Between TCP and UDP, and each of them writes an upper-layer protocol.

TCP is link-oriented. TCP's three-way handshake ensures connection reliability to a large extent.

Before UDP transmits data, it does not establish a connection with the other party. The data received by the connection does not send a confirmation signal, and the sending end does not know whether the data will be correctly received. Of course, you do not need to resend the data, therefore, UDP is a connectionless and unreliable data transmission protocol.

Because UDP does not confirm data, the transmission rate is faster and the real-time performance is better.

There are many upper-layer protocols, such as TCP: HTTP, FTP, SMTP; UDP: NFS, TFTP, SNMP, and SNMP.

Program and Algorithm Design

  1. Array A = {A_0, A_1, A_2 ,..., A_n} (You are variable), print the combination of all elements

The program code is:

# Include <iostream>

# Include <sstream>

# Include <string>

Usingnamespace STD;

Voidmain (){

String * str_arr = new string [10];

Int Len = 10;

For (INT I = 0; I <Len; I ++)

{

Ostringstream OSS;

OSS <I;

Str_arr [I] = "A _" + oss. STR ();

}

Cout <"combination result:" <Endl;

For (INT I = 0; I <Len; I ++)

{

For (Int J = I + 1; j <Len; j ++ ){

Cout <str_arr [I] <"-" <str_arr [J] <"";

}

Cout <Endl;

}

Cin> Len; // prevent window close after running

}

  1. The size of any two adjacent elements in array a differs by 1. Given such an array A and the target integer T, locate the position of T in array.

Program code:

# Include <iostream>

# Include <math. h>

Usingnamespace STD;

Voidmain ()

{

Constint Len = 12;

Intnums [Len] = {1, 2, 4, 5, 4, 3, 2, 1, 0,-1,-2,}, find;

Cout <"Enter the number to search" <Endl;

Cin> Find;

Int I = 0;

While (I <Len)

{

Int TMP = ABS (find-nums [I]);

If (TMP = 0)

{

Cout <"Location:" <I;

Break;

}

Else if (I + TMP <Len)

{

I + = TMP;

}

Else

{

Cout <"the element to be searched is not in the array ";

Break;

}

}

Cin> Find; // prevent window close after running

}

  1. Calculate the area (high multiplication width) of the binary tree. The height indicates the maximum distance from the root node of the binary tree to the leaf node, and the width indicates the number of knots with the maximum binary tree.

Because the tree operation needs to be encapsulated, the code is omitted. The specific idea is: Advanced depth first search, get the height of the tree, then perform breadth first search to get the width of the tree, and then multiply it.

System Design Questions

Given a Baidu map, for a certain point on the map, you need to mark the information of the point on the map, the information is abstracted into a rectangle, you can mark on the left of the point, you can also mark it on the right of the store. However, the rectangle after any two points cannot be overwritten. Otherwise, a vertex is deleted.

Question 1: Design an algorithm for a fixed area and Mark enough points.

Problem 2: when there are enough points, the algorithm may encounter a performance bottleneck and needs to be optimized again.

This is really not, just want to raster the map.


This article is from the blog of "Tiger brother", please be sure to keep this source http://7613577.blog.51cto.com/7603577/1560280

Baidu software development (Shanghai site)

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.