a4nodequeue's Introduction
CSC 340 Assignment 4 Implementation of Node: Node is a simple data container that allows single linkage. class Node { public: Node(int value); Node *next; int value; }; All members are public because the class is not intended for use outside the this library. Queue is implemented as a singly linked list, the Node's "next" member allows the elements of Queue to "link" to eachother. void Queue::enqueue(int value){ if(this->isEmpty()){ beginning = new Node(value); end = beginning; } else { end->next = new Node(value); end = end->next; } count ++; } int Queue::dequeue(void){ if( this->isEmpty() ) { return EMPTY_VALUE; } int ret = beginning->value; Node *toBeDestroyed = beginning; beginning = beginning->next; delete(toBeDestroyed); count --; return ret; } output: Creating QueueTest --- Testing queue is not empty --- PASS --- Testing queue size is 30 --- PASS --- Testing queue front is 6203 --- PASS --- Testing queue size is 30 --- PASS --- Testing dequeue should be 6203 --- PASS --- Testing queue size is 29 --- PASS --- Testing queue front is 812 --- PASS --- Testing clearing the queue (isEmpty and dequeue) --- PASS --- Testing queue is empty --- PASS --- Testing default value returned when dequeue called on empty Queue --- PASS Destroyed QueueTest
a4nodequeue's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.