Write the pseudocode for a “push” member methodusing an array (holding type double) implementation. You should assume the existence of an integer variable (called top) which refers to the index of the first OPEN cell. DO NOT ASSUME THE EXISTENCE OF ANY OTHER METHODS (i.e. don’t use any other methods). Read question carefully, use standard definitions and naming conventions for the stack and queue data structures, figure out the requirements, inputs & outputs (as appropriate), as well as any required error checks.
Pseudocode for push method: push( double data, int size)
Input: data value required to push into stack., Stack size is required to check overflow.
Output: return 1 after successful operation, return 0 for unsuccessful operation.
1.if top =size -1
1.1. Print stack overflow
1.2. return 0
2. Otherwise
2.1. top= top + 1
2.2.Stack[ top]. = data
2.3.return 1
Write the pseudocode for a “push” member methodusing an array (holding type double) implementation. You should assume t...
Write the pseudocode for a non-member method“dequeue” which is utilizing a linked list. The list node has 2 attributes: data and next. The method would take a “front” and “rear” reference and will return a “character” (the data element from the de-queued node). **Special note: DO NOT ASSUME THE EXISTENCE OF ANY OTHER METHODS (i.e. don’t use any other methods). Use basic definitions and standard naming conventions for the stack and queue data structures, figure out the requirements, inputs &...
Create an array-based implementation of a stack. Each element of the stack should store a string. The stack class should include 3 private member variables (maximum stack size, top of the stack index, and a pointer to the array that holds the stack elements). Public member methods should include a constructor (with an argument of stack maximum size that is used to create a dynamic array), a destructor (that deletes the dynamic array), a push method (argument is a string),...
C++ Create an array-based implementation of a stack. Each element of the stack should store a string. The stack class should include 3 private member variables (maximum stack size, top of the stack index, and a pointer to the array that holds the stack elements). Public member methods should include a constructor (with an argument of stack maximum size that is used to create a dynamic array), a destructor (that deletes the dynamic array), a push method (argument is a...
Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue (ABQ). A stack is a linear data structure which follows the Last-In, First-Out (LIFO) property. LIFO means that the data most recently added is the first data to be removed. (Imagine a stack of books, or a stack of papers on a desk—the first one to be removed is the last one placed on top.) A queue...
Please Write Pseudocode or Python code!
Thanks!
P1. b) is the following:
W1. (6 marks) Write the pseudocode for removing and returning only the second element from the Stack. The top element of the Stack will remain the top element after this operation. You may assume that the Stack contains at least two items before this operation. (a) Write the algorithm as a provider implementing a Stack using a contiguous memory implementation. You can refer to the implementation given in...
You will write the following files: mystack.h - contains the class definition for the mystack class. mystack.cpp - contains the definitions for member functions of the mystack class. inpost.cpp - contains your convert() function. inpost.h - contains the function prototype for convert() so that the main() can call it. Each of the files (with the exception of inpost.h) is described in more detail below. All header files should contain header guards to prevent them from being included multiple times in...
AQueue.java
class AQueue implements Queue {
private E queueArray[]; // Array holding queue elements
private static final int DEFAULT_SIZE = 10;
private int maxSize; // Maximum size of queue
private int front; // Index of front element
private int rear; // Index of rear element
// Constructors
@SuppressWarnings("unchecked") // Generic array allocation
AQueue(int size) {
//BUG #1: maxSize = size
maxSize = size+1; // One extra space is allocated
rear = 0; front = 1;
queueArray = (E[])new Object[maxSize]; //...
Purpose This assignment is an exercise in implementing the Stack ADT using a dynamically-allocated array, as well as techniques for managing dynamically-allocated storage in C++. Assignment In this assignment, you will write a class called Stack that will encapsulate a dynamically-allocated array of elements of a generic data type. A driver program is provided for this assignment to test your implementation. You don't have to write the tests. Program You will need to write a single template class for this...
C++ Linked List Implementation Motivation As we discussed in class, the data structures that you use to implement your program can have a profound impact on it's overall performance. A poorly written program will often need much more RAM and CPU time then a well-written implementation. One of the most basic data structure questions revolves around the difference between an array and a linked list. After you finish this assignment you should have a firm understanding of their operation. Problem...
- Complete the code to solve a maze- Discuss related data structures topicsProgramming-----------In this part, you will complete the code to solve a maze.Begin with the "solveMaze.py" starter file.This file contains comment instructions that tell you where to add your code.Each maze resides in a text file (with a .txt extension).The following symbols are used in the mazes:BARRIER = '-' # barrierFINISH = 'F' # finish (goal)OPEN = 'O' # open stepSTART = 'S' # start stepVISITED = '#' #...