Baidu's online test questions [no answer]

Source: Internet
Author: User
Baidu's online test questions

1. A text file contains multiple lines, each with a URL. Compile the code to calculate the file name in the URL and the number of occurrences.
A) the file name does not include domain name, path, and URL parameters, such as http://www.rs.com/n.op/q/rs? The file name in ID = 1 is Rs.
B) some URLs may have no file names, for example, http://www.abc.com/. this type of statistics shows a blank file name ".
C) the same file name that appears in different URLs is treated as the same file name, such as the http://www.ceshi.com/hi.php
The same file name as ftp://ftp.cdef.com/hi.php

File Content example:
Http://www.test.com/abc/de/fg.php? Http://www.test.com/index.html id = 1 & url =
Http://www.ceshi.com/hi.jsp
Ftp://ftp.ceshi.com/hi.jsp
Http://www.hello.com/cw/hi.jsp? K = 8
Http://www.hi.com/jk/l.html? Id1_1&s=a.html
Http://www.rs.com/n.op/q/rs? Id = 1
Http://www.abc.com/

2. A simple forum system stores the following data in a database:
User name, email, homepage, phone number, contact address, post title, post content, reply title, and reply content.
The number of Forum visits is about 3 million per day, and the number of posts updated is about 0.1 million.
Provide the database table structure design, and briefly describe the design ideas based on the paradigm.

3. Two files exist,
A) Data File A, in the format of keyword, IP address, and time. The number of records is about 10 million. The file is unordered.
B) data file B is the corresponding table file from the keyword ID to the keyword. The format is ID and keyword. The number of records is about 1 million, which is also unordered. The records in the corresponding table are one-to-one, and there are no duplicate IDs or keywords.
It is required to replace the keyword corresponding to data file a with the ID in B and generate a new data file C. The format of data file C is: keyword ID, IP address, and time.
Design a program to implement the above functions and analyze the time complexity and space complexity. The memory of the server used to run the program is 1 GB, and the hard disk is large enough. (At least give key algorithms and design ideas)

 

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.