Basic concepts of Data Structure c language and basic concepts of Data Structure c

Source: Internet
Author: User

Basic concepts of Data Structure c language and basic concepts of Data Structure c

Algorithm: A set of command sequences that complete specific tasks
Input, output, deterministic, finite, and valid.

Recursion: The function calls itself, or the function calls other functions, and this function calls the main function (indirect recursion ).
1) construct the boundary condition for recursive call termination
2) Implement recursive calls so that each recursive call can approximate the final solution.
Example:Binary Search Recursion

int binsearch(int list[],int searchnum,int left,int right){    int middle;    if(lest<=right)    {        middle=(left+right)/2;        switch(COMPARE(list[middle]),searchnum){        case -1:return binsearch(list,searchnum,middle+1,right);        case 0:return middle;        case 1:return binsearch(list,searchnum,left,middle+1);}    }    return -1;}

Typical Recursion: Factorial, binary coefficient, Horna rule, Fibonacci series, Aekerman function, Hanoi Tower, etc.

Data Type: Is the sum of an object set and a group of operations on these objects.
ABSTRACT Data Type: It is a data type. The specifications of operations on its data objects and objects are independent of the storage representation of objects and the implementation of operations on objects.

Algorithm performance analysis:
Performance Analysis: Time, space
Spatial complexity: Number of buckets required for execution from the beginning to completion.
S (P) = c + Sp (I)
C: fixed space requirements, independent of program input, output quantity, and size.
Sp (I): Variable storage space required by program P on instance I.
Time Complexity: The computing time required by the program from execution to completion.
Determined by the number of execution steps required for the function compiled by the program. There are three types of steps: the best, the worst, and the average.
Use a large OSN:
O (1): constant order
O (n): Linear order
O (logn): Log Level
O ( N2 ): Square level
O ( N3 ): Cubic level
O ( 2n ): Exponential
O (1)

Related Article

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.