Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write \"Stack with Array Implementation/arrayStack.h\", which MUST declare all c

ID: 3807352 • Letter: W

Question

Write "Stack with Array Implementation/arrayStack.h", which MUST declare all class members and define (all member functions below) as a "CLASS" using array implementation. InitializeStack isEmptyStack top pop push Add a function member, 'displayFIFO', to the linkedStackType (h file) data structure. Thus, if the stack was 3 beta top 2 1 the following statement: stack.displayFlFO(); will display: 1 2 3 Write "linkedQueue.h". which MUST declare all class members and define (all member functions below) as a "CLASS" using linked list. InitializeQueue isEmptyQueue addQueue deleteQueue front Write a programming segment/function (in.ccp for example) that uses a stack and 2 queues of characters. Traverse through the characters in the stack and put the vowels in one queue and all other character s in the second queue.

Explanation / Answer

Answer to Question# 5: The question is to add a function member displayFIFO() to the header file. Header file will contain only function declarations. Hence the answer would be

//LinkedStack.h

//==================

Class Stack{

void DisplayFIFO();

}

//======================

Answer to Questio#6:

//Your LinkedQueue.h header file would be like below. I have used charcter data type for the queue

//LinkedQueue.h:
//===============================
#ifndef LINKEDQUEUE_H
#define LINKEDQUEUE_H


#include <iostream>
using namespace std;

struct Node
{
char ch;
Node *next;
};

class LinkedQueue
{
private:
Node *head, *tail;   

public:
void InitializeQueue(); // Intializes queue
void DeleteQueue(); // Remove all elements from the queue
bool AddQueue(char ch); // Add an element in the queue
char Dequeue(); // Remove an element from the queue
bool isEmptyQueue(); // Return true if queue is empty
Node Front(); // Return true if queue is full
};

#endif
//==========================================


// All the function definitions are present in the below file called CLASS.cpp file.
// Place the both header and .cpp files in same folder
//CLASS.cpp

//==================================================
#include "LinkedQueue.h"

//Function InitializeQueue
// Initializes the queue to NULL

LinkedQueue::InitializeQueue()
{
head = tail = NULL;
}


// Function: AddQueue()
// Purpose: Adds an elements into the queue.

bool LinkedQueue::Enqueue(char ch)
{
Node *temp;

// Check if the Queue is full
if(isFull()) return false;

// Create new node for the queue
temp = new Node ();
temp->ch = ch;
temp->next = NULL;

  
if(head == NULL)
head = tail = temp;
else
{
tail->next = temp;
tail = temp;   
}

return true;
}


// Function: DeleteQueue()

char LinkedQueue::DeleteQueue()
{
char ch;
Node *temp;

// Check for empty Queue
if(isEmpty()) return NULL; // Return null if queue is empty
else
{
ch = head->ch;
temp = head;
head = head->next;
delete temp;
// Check if queue is empty
if(isEmpty())
{
head = tail = NULL;
}
}
return ch; // Return deleted character
}


// Function: isEmpty()

bool LinkedQueue::isEmpty()
{
return (head == NULL);
}


// Function: FRONT()

Node LinkedQueue::FRONT()
{
return head;
}
//==================================

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote