Nineth Week Technical Blog

Source: Internet
Author: User

Nineth Week Technical Blog

Chained queues

242 Chen Kunxin Nineth Week. Cpp:defines the entry point for the console application.

//

#include "stdafx.h"

#include "stdio.h"

#include "Stdlib.h"

typedef int DATATYPE;

typedef struct SPACE

{

DataType data;

Space* Next;

}space;

typedef struct QUEUE

{

space* Base;

space* top;

int length;

}queue;

queue* InitQ ()

{

Queue *myq;

myq= (Queue *) malloc (sizeof (queue));

myq->length;

Myq->base= (Space *) malloc (sizeof (space));

myq->base->next=null;

myq->top=myq->base;

return MyQ;

}

void Insq (queue* MyQ, DataType data)

{

Space *temp= (Space *) malloc (sizeof (space));

temp->next=null;

temp->data=data;

myq->top->next=temp;

myq->top->next=myq->top->next->next;

myq->length++;

}

void Remq (queue* myQ)

{

if (myq->length==0)

printf ("The queue is empty");

space* temp=myq->base->next;

myq->base->next=myq->base->next->next;

Free (temp);

myq->length--;

}

void GetTop (queue* myQ)

{

printf ("%d \ n", myq->base->next->data);

}

int main (int argc, char const *argv[])

{

/* Code */

return 0;

}

Week number

Professional Learning Goals

Professional Learning Time

New Code Volume

Blog post Volume

Learning in the Humanities

Knowledge and Skills Summary

Nineth Week

Learning the use of chained queues

4

100h

1

No

The concept of chained tables and queues is not quite understood, and is always a practical failure.

Nineth Week Technical Blog

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.