数据结构的一道题(国外英文资料).docVIP

  • 7
  • 0
  • 约1.81万字
  • 约 41页
  • 2017-06-05 发布于河南
  • 举报
数据结构的一道题(国外英文资料)

数据结构的一道题 Basic operation of the 8584 circular queue Time limit: 1000MS memory limit: 1000K Number of submissions: 3772:1884 Problem: programming language: unlimited The Description Create an empty loop queue and implement basic algorithms such as queue, team, return queue length, return team header element, and queues traversal. Please complete the following procedure. # include malloc. H # include stdio, h 1 # define OK # define the ERROR 0 Typedef int the Status; / / Status is the type of function, whose value is the functions resulting Status code, such as OK Typedef int QElemType; # define MAXQSIZE 100 / / maximum queue length (for loop queues, the maximum queue length is 1) Typedef struct { QElemType * base; / / initialize the dynamically allocated storage space Int the front; / / head pointer, if the queue is not empty, points to the queue header element Int rear; / / tail pointer, if the queue is not empty, point to the next location of the queue tail element } SqQueue; The Status InitQueue (SqQueue Q) { / / construct an empty queue Q that has a predefined size of MAXQSIZE / / please complete the code } Status EnQueue (SqQueue Q, QElemType e) { / / insert the new queue element for Q / / please complete the code } Status DeQueue (SqQueue Q, QElemType e) { / / if the queue is not empty, remove the team header element of Q, return its value with e, and return OK. Otherwise it returns the ERROR / / please complete the code } Status GetHead (SqQueue Q, QElemType e) { / / if the queue is not empty, return the header element with e, return OK, or return ERROR / / please complete the code } Int QueueLength SqQueue (Q) { / / the number of elements that return Q / / please complete the code } The Status QueueTraverse SqQueue (Q) { / / if the queue is not empty, the queue element is printed from the header to the queue, and it returns OK. Otherwise returns the ERROR. Int I; I = Q.f ront; If ( The Queue is Empty! ) / / please fill in the blanks The else { Printf

文档评论(0)

1亿VIP精品文档

相关文档