Cheng xuanyuan's story

Source: Internet
Author: User

The story is as follows:

Cheng xuanyuan left the library carrying a pile of books (n.

The alarm rang. The old lady swept the floor and asked her to see which book sounded the alarm. Xu yuan poured out the book and prepared a test.

The old lady was in a hurry and split the book into two parts. The first copy passed and rang.

I divided this one into two parts and went on the test. I found it three times. The old lady swept the floor with the eyes of the Thunderer, as if he was talking about O (N) and O (log2n) cannot tell.

This story seems to be saying that even the old lady who swept the floor will have a binary algorithm (Master in the civil society). Cheng xuanyuan, a programmer, actually needs a test...



The truth of the story is as follows:

As a programmer, Cheng xuanyuan won't use the binary algorithm. She cleverly used the Sweeping Old Lady's binary algorithm to successfully "borrow" n-1 books from the library.

Because the story does not assume that the alarm book is a book.


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.