***C++ w/data structure*** ***Please keep original files*** What would be the missing functionality in the code and what would be the complexity time for each function that has been added. class Stack { int top; public: int a[MAX]; // Maximum size of Stack Stack() { top = -1; } bool push(int x); int pop(); int peek(); bool isEmpty(); }; bool Stack::push(int x) { *insert code* } int Stack::pop() { *insert code* } int Stack::peek() { *insert code* } bool Stack::isEmpty() { *insert code* }
Q: What is exactly printed by this code? What is the output if we replace break into continue? for i in…
A: The question has been answered in step2
Q: Examples encrypt("banana") "Onen@baca" encrypt("karaca") "ecor@kaca"
A: In this problem, we need to design a code in a programming language: - Create a method with one…
Q: For this assignment you will be building on your Fraction class. However, the changes will be…
A: Here we have built a Fraction class. we also correctly handle Fractions that are negative, improper…
Q: Write an efficient Selection Structure that accomplishes the following task: Covid-19 Vaccination…
A: The complete python code is below:
Q: What is the asymptotic run time of the following function? Function f(n) r = 0 for i from 0 to n for…
A: The question has been answered in step2
Q: (a) Construct the truth table for the following Boolean function f(x, y, z)=(x^y)v (x'^ y^z) v…
A: A) Que Ans:-
Q: Explain how a malicious actor with knowledge of automata could alter the function of the systems…
A: Automata:- A computer system that automatically executes a preset sequence of actions is referred to…
Q: What is the difference between top-down and bottom-up processing? Write your own example for each of…
A: Introduction: Although, as we all know, our sense receptors constantly collect data from our…
Q: Write generic ant algorithm. Describe application of particle Swarm Algorithm.
A: An algorithm is a procedure used to solve a problem or perform a calculation. Algorithms act as a…
Q: def findRecommendations (matches): Specific Restrictions (in addition to the general restrictions…
A: 1) Below is python program which defines a function findRecommendations, which takes a list as…
Q: Write a program to print the square and the cube of a series of numbers (1,2,3..5), but it displays…
A: Introduction: In this question, we are asked to write a C++ program to print squares and cubes in…
Q: Provide a different implementation of ChoiceQuestion. Instead of storing the choices in an array…
A: In this question it is asked to complete the given java code. The question statement states to add…
Q: Implement the EvenOdd application that asks a user to enter an integer. Display a statement that…
A: Here is the approach : Create the method to check if the number is even or odd . First take the…
Q: In [ ]: Problem 1 Write a function count123: int list -> int * int * int that takes in an int list 1…
A: Note :- You have not mention the language of the program so, i'm answering your question in python…
Q: Explain the characteristics of Ant Colony optimization.
A:
Q: on the current status of IPv4 and identify the
A: The answer is
Q: Given the default schema of a database: Orders 123 Orderld OrderDate ADC OrderNumber 123 Customerld…
A: Here we have given the suitable options for the asked query with select statement. You can find the…
Q: 2. Consider the network for car diagnosis shown in the figure above. a. Extend the network with…
A: According to the information given:- We have to follow the instruction in order to extend the…
Q: Show exact output?
A: In step 2, I have provided ANSWER with breif explanation----------- In further steps , I have…
Q: Consider the following example: MOV AL, -5 SUB AL, +125 After executing these two lines of…
A: MOV AL, -5 It will move -5 in AL SUB AL, +125 It will Subtract 125 from -5 As Range is from -128…
Q: How to represent the individuals (organisms) that make up an evolving population?
A:
Q: q15- Which statements are correct about references in Excel? a. An absolute reference will not be…
A: There are two types of cell references relative and absolute. Relative and absolute references…
Q: For two functions f(n) and g(n), if there exist constants c, n >0 such that, for all n≥n, f(n) ≤c ·…
A: Asymptotic notations are used to measure the complexities of various algorithms.
Q: Explain different kinds of slips.
A:
Q: Simulated annealing requires a very small amount of memory, just enough to store two states: the…
A: Given: Simulated annealing requires a very small amount of memory, just enough to store two states:…
Q: Refer to the ArrayCollection.java in your Canvas Modules. If N represents the number of elements in…
A: We need to find the correct option for the given Java scenario.
Q: Write a program using using Sqlite3 in python that stores names, emails, cell phone numbers,…
A: Please find the answer below :
Q: import java.util.Scanner; public class WinningTeam { public static void main(String[] args) {…
A: Dear student in Team.java class set methods were not correct. Now corrected and program is working…
Q: Host IP Address: Original Subnet Mask New Subnet Mask: Number of Subnet Bits Number of Subnets…
A: Solution - An step by step solution is given below : 1. The given host IP Address is…
Q: dec 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 bin 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010…
A: Upto 0 to 9 Both in decimal and hex are same
Q: By using java, Write a recursive function that finds the maximum element in an array of integers,…
A: Recursive function:- Recursion is the action of a function calling itself either directly or…
Q: Q.5 Explain any two of the following HCI principles in brief 1) Know of user II) Understand the task…
A:
Q: You wish to create a circuit that functions similarly to an SR latch but accepts the input S1R1=11…
A: The truth table of the S-R latch is as follows: S R Q+ 0 0 Q 0 1 0 1 0 1 1 1 Invalid…
Q: are divisible by 2, print
A: for j in range(1, 51): if j % 5 == 0: print("HiFive") elif j % 2 == 0:…
Q: Given the following function Oracle user account: Jsmith Profile: Manager_prof Password verify…
A: Query to change the password ALTER USER JSmith IDENTIFIED BY CatChaseDog!;
Q: Question 5 Numerical Approximation Methods basic ideas: Please write the basic idea (with key…
A: Linear Equations Anything connected to a line is said to be linear. To build a line, all of the…
Q: Write a prolog code to double an integer number? Integer as an end user input.
A: :: Solution :: step: 1 double_integer(N):- write('Please Enter a…
Q: List human input-output channels and discuss briefly about it.
A: We have to list human input-output channels and explain briefly about it.
Q: Given the default schema of a database:
A: Introduction: SQL queries are the queries that are used in structured query languages just to…
Q: Write a method named computeTax that accepts a salary as a parameter and that returns the amount of…
A: The method will accept an integer parameter salary and returns the double parameter tax So, the…
Q: I have a Java Program that takes input from the command line. It takes 3 strings from the command…
A: I have provided JAVA CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT-------------
Q: ▪ Include the following information as comments at the top of your program (file name, your name,…
A: given: we have to write a python code for the following statements.
Q: Create a java program that asks a user to input student’s full name and reverses the string. The…
A: Introduction: In this question, we are asked to write a JAVA program to revers a Full Name by using…
Q: Please answer both questions.
A: The question has been answered in step2
Q: What is centralizing email communications in cloud computing?
A:
Q: 1. Consider the Bayesian network in the figure above. a. If no evidence is observed, are Burglary…
A:
Q: Consider the instruction Load 200. Given the following memory and register R1 contents: Memory 120…
A: Instruction is: LOAD 200 The instruction format is: OP code | Address Now, based on the…
Q: Examples uniqueStyles([ "Dub, Dancehall", "Industrial, Heavy Metal", "Techno, Dubstep", "Synth-pop,…
A: In this problem, we need to design a code in a programming language: - Use the logic that we…
Q: Form a subclass StateQuarter from the class Coin. A state quarter has a state theme. The toString…
A: The toString() method is used to get a String object representing the value of the Class Object.
Q: What is the output of the following if statement? a, b = 12,5 if a + b: print('True') else:…
A: OUTPUT
***C++ w/data structure*** ***Please keep original files***
What would be the missing functionality in the code and what would be the complexity time for each function that has been added.
class Stack {
int top;
public:
int a[MAX]; // Maximum size of Stack
Stack() { top = -1; }
bool push(int x);
int pop();
int peek();
bool isEmpty();
};
bool Stack::push(int x)
{
*insert code*
}
int Stack::pop()
{
*insert code*
}
int Stack::peek()
{
*insert code*
}
bool Stack::isEmpty()
{
*insert code*
}
Step by step
Solved in 7 steps with 4 images
- C++ ProgrammingActivity: Linked List Stack and BracketsExplain the flow of the main code not necessarily every line, as long as you explain what the important parts of the code do. The code is already correct, just explain the flow SEE ATTACHED PHOTO FOR THE PROBLEM INSTRUCTIONS int main(int argc, char** argv) { SLLStack* stack = new SLLStack(); int test; int length; string str; char top; bool flag = true; cin >> test; switch (test) { case 0: getline(cin, str); length = str.length(); for(int i = 0; i < length; i++){ if(str[i] == '{' || str[i] == '(' || str[i] == '['){ stack->push(str[i]); } else if (str[i] == '}' || str[i] == ')' || str[i] == ']'){ if(!stack->isEmpty()){ top = stack->top(); if(top == '{' && str[i] == '}' || top == '(' && str[i] == ')' ||…Consider the producer-consumer problem where the producer produces items to be consumed by the consumer. A solution of the problem is to be implemented using threads. The main process will run producer and consumer as two different threads. The producer will put the items it generates into a buffer of length 15. The consumer reads the elements of the buffer to get the items. A solution is given below. Each item produced and consumed are also printed to the screen. Run the program several times and find a sample run when the items produced are not correctly consumed. Explain why the program does not always work correctly.Language: c++ Please solve problem completely according to requirement, program should must be follow all the rules of menu base system which are required and write in question: Attach the output's screentshots and explain every line with comments: Whole code should be user defined inputs not fix: Task : Address Book (List)• Your program will be a menu driven program. Address book will be implemented using the ArrayList.Description: We want to build an address book that is capable of storing name, address & phone number of a person. Address book provides functionality in the form of a menu. The feature list includes:• Add – to add a new person record• Delete – to delete an existing person record by name• Search – to search a person record by name Sort - to sort the file after adding a new person record. · Exit – to exit from application
- C++ data structures Write functions fill and print. 1. function fill in 2 queue with random intgers " rand%100 ". 2. function to print the random intgers from the 2 queue we filled. 3. store the common items in the 2 queues in an additional queue like " queue number 3" note: solve it without using different data structure such as array.C++ The programme below is in C language. Please help me convert the whole programme into C++ language The code: #include<stdio.h> #include<stdlib.h> #include<string.h> struct node { char data[100]; struct node* next; }; int elements = 0; // function for add values to stack struct node* add(struct node* stack, char *str) { struct node* tp = (struct node*)malloc(sizeof(struct node)) ; strcpy(tp->data,str); tp->next = stack; elements++; return tp; } //redo function void redo(struct node* stack) { if(stack == NULL) return; elements++; } //undo function void undo(struct node* stack) { if(stack == NULL) return; elements--; } //print function int print(struct node* stack,int idx) { if(stack == NULL) return 0; idx =…given code #include <stdio.h>#include <stdlib.h> /* typical C boolean set-up */#define TRUE 1#define FALSE 0 typedef struct StackStruct{int* darr; /* pointer to dynamic array */int size; /* amount of space allocated */int inUse; /* top of stack indicator - counts how many values are on the stack */} Stack; void init (Stack* s){s->size = 2;s->darr = (int*) malloc ( sizeof (int) * s->size );s->inUse = 0;} void push (Stack* s, int val){/* QUESTION 7 *//* check if enough space currently on stack and grow if needed */ /* add val onto stack */s->darr[s->inUse] = val;s->inUse = s->inUse + 1;} int isEmpty (Stack* s){if ( s->inUse == 0)return TRUE;elsereturn FALSE;} int top (Stack* s){return ( s->darr[s->inUse-1] );} /* QUESTION 9.1 */void pop (Stack* s){if (isEmpty(s) == FALSE)s->inUse = s->inUse - 1;} void reset (Stack* s){/* Question 10: how to make the stack empty? */ } int main (int argc, char** argv){Stack st1; init (&st1); push…
- C++ Coding Assignment: Redo the 8 queens 1-dimensional array program with backtracking by REMOVING ALL GOTO's, but implementing the same algorithm. GIVEN C++ CODE - WITH GOTO's: #include <iostream>using namespace std; int main() { int q[8], c=0; q[0] = 0; // place a queen in row 0 of column 0 int counter = 0; // to count solutions // c: column as q[c]: row in column c next_col: ++c; // or c++; // next column if(c==8) goto print; q[c]=-1; // 0 next_row: ++q[c]; // or q[c]++; // next row if(q[c]==8) goto backtrack; for(int i=0; i<c; ++i) if(q[i]==q[c] || (c-i)== abs(q[c]-q[i])) // || = row test OR diagonal tests goto next_row; goto next_col; backtrack: --c; // or c-- if(c==-1) // once we backtrack to column -1, we have all the solutions. return 0; // ends the program goto next_row; print: counter++; // new solutions cout << counter << ":" << endl; for(int…Convert from C to C++ .Thank you. / include all required libraries#include<stdio.h>#include<stdlib.h>#include<sys/types.h>#include<sys/wait.h>#include<unistd.h> // variable to store number of generationsint num_generations; // function to print the generationsvoid printGeneration(int n){// stop if number of generations are reachedif(n>num_generations)return; // create a forkpid_t p = fork(); // generate new generationsif(p==0)printGeneration(n+1);else if(p>0)wait(0); // wait until child process terminates // print the present generationif(p!=0){// if n is 0if(n==0)printf("Parent. "); // print parent// if n is 1else if(n==1)printf("Child. "); // print child// for all other caseselse{// print grandchildrenfor(int i=0;i<n-2;i++)printf("Great ");printf("Grandchild. ");}// print pid and ppidprintf("pid: %d ppid: %d\n",getpid(),getppid());}} // main functionint main(int argc, char* argv[]){// if no arguments are providedif(argc==1){// print…Please fill in the blanks for C. /* This program will create a doubly linked list of full names. */ #include<stdio.h> #include<stdlib.h> #define LEN 100 //max length //Declare a node of string that contain a person's full name // each node has a value and 2 pointers that points to the next node and previous node struct node { __1__ value[__2__]; //to save the string (full name) __3__ __4__ next; //pointer points to next node __5__ __6__ prev; //pointer points to previous node }; /* - This function takes the head pointer and iterates through the list to get one full name at a time from the user, and save it to our list - The function uses getchar() to get 1 character at a time, and only stops when user presses Enter. - During each iteration, check if user inputs a name that is longer than max size. + Remember, if maxLen is 100, then the longest valid inputted string len is 98, because 99th index is for null character. + So we…
- Assignment for Computer Architecture: N Factual by Recusion *please have comments in the code* You are to write a program in MIPS that computes N! using recursion. Remember N! is the product of all the numbers from 1 to N inclusive, that is 1 x 2 x 3 x (N – 1) x N. It is defined as 1 for N = 0 and is undefined for values less than 0. The programs first requests the user to input the value of N (display a prompt first so the user knows what to do). If the input value is less than 0, the program is to display “N! undefined for values less than 0” and then requests the user to input the value of N again. If the value input is non-negative, it is to compute N! using a recursive function, that is one that calls itself. You are to have your name, the assignment number, and a brief description of the program in comments at the top of your program. Since this is an assembly language program, I expect to see comments on almost every line of code in the program. Also make the…Python only** define the following function: 1. This function must add a task to a checklist, setting its initial value to False. It will accept two parameters: the checklist object to add to, and the task name to add. In addition to adding the task, it must return the (now modified) checklist object that it was given. There is one issue, however: a task cannot be added to a checklist if the name requested is already being used by another task in that checklist. In that case, this function must print a specific message and must return None Define addTask with 2 parameters Use def to define addTask with 2 parameters Use a return statement Within the definition of addTask with 2 parameters, use return _ in at least one place. Do not use any kind of loop Within the definition of addTask with 2 parameters, do not use any kind of loop.C++ ProgrammingTopic: Stack, Ques and DequesBelow is the initial program of the main file, only modify the main file, sllstack file also provided. See attached photo for instructions. main.cpp #include <iostream> #include <cstring> #include "sllstack.h" using namespace std; int main(int argc, char** argv) { SLLStack* stack = new SLLStack(); int test; string str; cin >> test; switch (test) { case 0: getline(cin, str); // PERFORM SOLUTION TO BRACKETS PROBLEM HERE // FYI: Place your variable declarations, if any, before switch. break; case 1: stack->push('a'); stack->push('b'); stack->push('c'); cout << stack->pop() << endl; cout << stack->pop() << endl; cout << stack->pop() << endl; cout << stack->isEmpty() << endl; break;…