Explore BrainMass
Share

Design a Queue Abstract Data Type Enqueue, Dequeue, Empty

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

I need to know how I would do the following program...simple please I have minimal C, C# or C++ background.

Design a queue abstract data type, including operations for enqueue, dequeue, and empty.

© BrainMass Inc. brainmass.com October 24, 2018, 8:47 pm ad1c9bdddf
https://brainmass.com/computer-science/c-sharp/design-a-queue-abstract-data-type-enqueue-dequeue-empty-107541

Solution Preview

I have added extensive comment to C code. Also added the executable as created by Miracle C.

#include <stdio.h>
#include <stdlib.h>
#define FALSE 0

typedef struct linkedlist{ //its a linked list of elements
int dataitem; //We can store an integer data item
struct linkedlist *next; // a pointer to the next item in the queue
} queue; // Queue Abstract Data structure

void Menu (int *choice); //User Menu to enter choices for the Queue
queue *enqueue (queue * Qpointer, int data); //Function to add an item to the tail/end of the queue
queue *dequeue (queue * Qpointer); //Function to get (and delete) an item to the head/beginning of the queue
void printQ (queue *Qpointer); //Print the Queue by starting from the beginning, following the chain of links until the end (NULL) has reached
void empty (queue *Qpointer); //Emtpy/clear the Queue

int main () { //The main() function
queue *Qpointer;
int ...

Solution Summary

I have added extensive comment to C code. Also added the executable as created by Miracle C.

$2.19
See Also This Related BrainMass Solution

Design a queue ADT

Design a queue abstract data type, including operations for enqueue, dequeue, and empty.
I am not familiar with abstract data types.

View Full Posting Details