Algorithm 4-7: sequential interface for associating Arrays

Source: Internet
Author: User

In addition to the put and get interfaces, the associated arrays also have some sort-related interfaces. The complete interface for associating arrays is as follows:

Public interface ST

 
  
{// Return the smallest Key Value public key min (); // return the public Value get (Key key) corresponding to the Key; // return the closest Value to the key, however, the public key floor (Key) of the key is not greater than the Key; // return the public key select (int n) of the nth small Key ); // return all the public Key [] keys (Key start, Key end) keys from start to end; // return the closest key to the Key, however, the public key ceiling (Key key) of the Key is not smaller than the key; // return the maximum public Key max (); // return the number of keys from start to end public int size (Key start, Key end ); // return the rank of the specified Key in the array public int rank (key Key );}

 


So far, we have only introduced the binary search method, but the complexity of this insert operation is still N. In the subsequent sections, we will introduce efficient algorithms to make all operations more complex than lg N.


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.