Data structure Analysis method

Source: Internet
Author: User

1. There is an ordered sequence of {1,3,9,12,32,41,45,62,75,77,82,95,100}, when finding a node with a value of 82 with a dichotomy, does the lookup succeed after several comparisons?

The question needs to be answered by using dichotomy to find ideas, using *low to point to the first element of the sequence, low=1;*high pointing to the last element of the sequence, high=13; Mid is the middle element, mid= (Low+high)/2,

Use the Reference code:

int binsearch (int r[],int n,int k) {

Low=1;high=n;

while (Low<=high) {

Mid= (Low+high)/2;

if (K<r[mid]) high=mid-1;

else if (K>[mid]) low=mid+1;

else return mid;

}

return 0;

}

Cycle 4 times


2. Press the new element into the sequential stack, move the top pointer first, and then deposit the element .

3. Logically divides the data structure into the linear structure, the nonlinear structure two categories.

4. A left and right subtree of two forks the number of empty pointer fields is 1after the preceding sequence is threaded.



Data structure Analysis method

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.