O (nlgk) problem queue header file C Language

Source: Internet
Author: User

/* Queue. H -- queue header file */<br/> # include "head. H "</P> <p>/* interface function declaration */</P> <p>/* operation: before creating and initializing a queue */<br/>/*: After PQ points to a queue */<br/>/*: if the memory allocation is successful, create and initialize the queue, and return true; otherwise, return false */<br/>/* time complexity: O (1) */<br/> bool initialize_q (queue * const PQ); </P> <p>/* operation: before determining whether a queue is empty */<br/>/* operation: PQ points to an initialized queue */<br/>/* operation: if this queue is empty, true is returned; otherwise false */<br/>/* time complexity: O (1) */<br/> bool isempty_q (const queue * const PQ); </P> <p>/* operation: add a data field to the queue as the specified data node */<br/>/* before the operation: PQ points to an initialized queue, item indicates the data to be added */<br/>/* operation: if the memory is allocated successfully, the node with the data field "item" is added to the queue, and true is returned; otherwise false */<br/>/* time complexity: O (1) */<br/> bool enqueue_q (const queue * const PQ, const item ); </P> <p>/* operation: deletes the header node from the queue and releases the occupied memory space, and assign the data field to the specified variable */<br/>/* before the operation: PQ points to an initialized queue, and messenger is a pointer to item, the function used to carry data back to call this function */<br/>/*: If the queue is not empty, delete the header node and release the memory space it occupies, update the header node and assign it to * messenger */<br/>/* time complexity: O (1) */<br/> bool dequeue_q (const queue * const PQ, item * const Messenger); </P> <p>/* operation: release the memory space occupied by a queue */<br/>/* before the operation: PQ points to an initialized queue */<br/>/* after the operation: the memory space occupied by this queue is released */<br/>/* time complexity: O (n) */<br/> void release_q (const queue * const PQ );

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.