Data Structure Tutorial 25th lesson Unit Quiz

Source: Internet
Author: User

Teaching Purpose: Review the contents of the previous study, test the learning effect, shortage make-up

Teaching Focus:

Teaching Difficulties:

Teaching Content:

Quiz questions:

One, fill in the blanks:

  1. The basic data structure has ____,____,____,____ four kinds.
  2. The storage structure can be divided into ____,____ according to the position of the data element in the machine.
  3. The basic requirements of the algorithm are _____,_____,____,____.
  4. The efficiency of measurement algorithm can be _______,_______ by two aspects.
  5. Definition of stack: _______________________.

Two, Jane answers:

  1. Examples illustrate the definition of data objects, data elements, and data items.
  2. What are the main differences between Class C language and C language?
  3. What are the basic operations of a linear table?
  4. Write out the static allocation sequence storage structure of the linear table defined by Class C language.

Third, the algorithm design:

    The following is the storage structure and insertion algorithm for the linear table below
    1. , and fill in the vacant part of the algorithm.

      #define List_init_size

      #define Listincrement

      typedef struct{

      Elemtype *elem;//Storage space address

      int length;//Current length

      int listsize;// The current allocated storage capacity is in the amount of a data element storage length of

      }sqlist;

      Status Listinsert (List *l,int i,elemtype e) {

      ____________ *p,*q;

      If (i<1| | i>l->length+1) return ERROR;

      q=& (l->elem[i-1]);

      for (P=&l->elem[l->length-1];p >=q;--p)

      ________________;

      *q=e;

      __________________;

      Return OK;

      }/*listinsert before I/

    2. below is the sequence storage structure of the stack and the stack, the stack algorithm, please add the empty part of the algorithm.

typedef struct{

Selemtype *base;

Selemtype *top; The purpose of setting the stack bottom two pointers is to make it easier to determine whether the stack is empty

int stacksize; The maximum capacity currently available for the stack.

}sqstack;

Status Push (Sqstack &s,selemtype e); {

if (s.top-s.base>=s.stacksize) {

S.base= (Elemtype *) realloc (s.base,

(S.stacksize + stackincrement) * sizeof (elemtype));

if (! s.base) exit (OVERFLOW);

S.top=s.base+s.stacksize;

S.stacksize+=stackincrement;

}

*s.top++=_____;

return OK;

}//push

Status POPs (Sqstack &s,selemtype &e); {

if (________)

return ERROR;

_____=*--s.top;

return OK;

}//pop

Iv. Questions and Answers:

  1. The process of inserting a node in a one-way linear list is illustrated with the illustration method.
  2. There is a student transcript that draws a storage image of the transcript data when using a chained storage structure.
  3. Using C language to achieve one-way linear linked list. Write out the storage structure definition and basic algorithm.

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.