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:
- The basic data structure has ____,____,____,____ four kinds.
- The storage structure can be divided into ____,____ according to the position of the data element in the machine.
- The basic requirements of the algorithm are _____,_____,____,____.
- The efficiency of measurement algorithm can be _______,_______ by two aspects.
- Definition of stack: _______________________.
Two, Jane answers:
- Examples illustrate the definition of data objects, data elements, and data items.
- What are the main differences between Class C language and C language?
- What are the basic operations of a linear table?
- 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
- , 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/
- 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:
- The process of inserting a node in a one-way linear list is illustrated with the illustration method.
- There is a student transcript that draws a storage image of the transcript data when using a chained storage structure.
- Using C language to achieve one-way linear linked list. Write out the storage structure definition and basic algorithm.