20172310 Blue Ink Cloud ASL Test 2018-1938872

Source: Internet
Author: User
20172310 Blue Ink Cloud ASL Test 2018-1938872 Topics:

The known linear table has the element {5,13,19,21,37,56,64,75,80,88,92}, what is the ASL if using the binary lookup method?

Answer: (Today because go to cheerleading rehearsal, so now finish this blog)

First of all, because there is no class, so oneself to understand binary search method

In computer science, binary search (English: Half-interval search), also known as binary searching (English: binary searches), logarithmic search (English: Logarithmic search), is a search algorithm that finds a particular element in an ordered array. Binary lookup applies only to sequential storage structures. To maintain the order of the table, it is necessary to move a large number of nodes to insert and delete in the sequential structure. As a result, binary search is especially useful for linear tables that are rarely modified and often need to be found once created.
For those linear tables that find little and often need to be changed, a chain list can be used as a storage structure for sequential lookups. Binary lookups cannot be implemented on a linked list.

The original binary search is two-point search. ASL is the average lookup length for binary lookups. The binary search process can be described using a two-fork tree: The nodes in the middle of the current search interval as the root, and the nodes in the Zoozi and right child tables as the Saozi right subtree of the root.

For a table with 11 nodes, if the found node is the 6th node in the table, only one comparison is required, and if the found node is the 3rd or 9th node in the table, two comparisons are needed, and the first 1,4,7,10 node needs to be compared three times, and the 2,5,8,11 node needs to be compared four times.

20172310 Blue Ink Cloud ASL Test 2018-1938872

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.