Data Structure ( PYTHON)
1 - What is the output to the terminal with this Python code
Dick = [“white”; 0x000000, “black” ;0xFFFFFF]
For item in dict;
Print(item)
2 - Which condition must a linked list implementation of a queue satisfy when the queue is empty
Front is empty
Rear is empty
Front is null
Rear is null
3 - Which method is to be used with a list in Python?
Append
An array of a Data size 17 is used where the index is an integer in [0, 16] and the hash-function key %17
4 - Where will the data associated with the key 29 be stored
In DATA[17] , inDATA[29], InDATA[12], inDATA[11]
5 - Given the Queue Q [“Cherry”, “orange”, “grape”]
After operation Q.enqueue(“apple”), Q.contains[“cherry”,”orange”,”grape”,”apple”]
6 - Which value will be returned when Q. Dequeue is called ?
Orange, apple, grape, cherry
7 - What should be counted when measuring the time factor to determine the efficiency of an algorithm
The kilobytes of the algorithm
The number of statements
The amount of microseconds
The number of operations
8 - Which command will delete and return an object at position index in a list ?
Set(int index, Object x)
Contains(Object x)
Remove(int index)
Get(int index)
9 - Which command will return the object at position index in the list when the list is not changed?
Set(int index, Object x)
Contains(Object x)
Remove(int index)
Get(int index)
1) white black 2) Front is null 3) Append 4) InDATA[12] 5) True 6) cherry 7) The number of operations 8) Remove(int index) 9) Get(int index)
Data Structure ( PYTHON) 1 - What is the output to the terminal with this Python...
HI USING C++ CAN YOU PLEASE PROGRAM THIS ASSIGNMENT AND ADD
COMMENTS:
stackARRAY:
#include<iostream>
#define SIZE 100
#define NO_ELEMENT -999999
using namespace std;
class Stack {
int arr[SIZE]; // array to store Stack elements
int top;
public:
Stack() {
top = -1;
}
void push(int); // push an element into Stack
int pop(); // pop the top element from Stack
int topElement(); // get the top element
void display(); // display Stack elements from top to bottom
};
void Stack...
Hello, I have some errors in my C++ code when I try to debug it.
I tried to follow the requirements stated below:
Code:
// Linked.h
#ifndef INTLINKEDQUEUE
#define INTLINKEDQUEUE
#include <iostream>
usingnamespace std;
class IntLinkedQueue
{
private: struct Node {
int data;
Node *next;
};
Node *front; // -> first item
Node *rear; // -> last item
Node *p; // traversal position
Node *pp ; // previous position
int size; // number of elements in the queue
public:
IntLinkedQueue();...
Create a Java code that includes all the methods from the
Lecture slides following the ADTs
LECTURE SLIDES
Collect/finish the Java code (interface and the complete working classes) from lecture slides for the following ADTS: 4) Queue ADT that uses a linked list internally (call it LQueue) Make sure you keep the same method names as in the slides (automatic testing will be performed)! For each method you develop, add comments and estimate the big-O running time of its algorithm....
//Look for** to complete this program --C+ please --please add comments // using namespace std; #include <iostream> #include <stdlib.h> #include < string> #include "queue.h" //Purpose of the program: ** Algorithm: * int main() /** "A", "B", "C" in the queue //** while loop -- indefinitely { try {//** catches } //* end of loop } |/ II II II II II //File type: ** queue.cpp using namespace std; #include <iostream> #include "queue.h" // constructor queue::queue () } //destructor queue::~queue() queue::queue...
(C++) (VISUAL STUDIO) Circular Queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the last position is connected back to the first position to make a circle. In a normal Queue, we can insert elements until queue becomes full. But once queue becomes full, we cannot insert the next element even if there is a space in front of queue. Efficiently implement a queue class using a circular...
Code in C++. Can someone make it so that the code below can be compiled? ▪ Creating an empty queue ▪ Inserting a value ▪ Removing a value ▪ Finding the size of the queue ▪ Printing the contents of the queue ▪ Adding the contents of one queue to the end of another ▪ Merging the contents of two queues into a third, new, queue Class Attributes Your class should be implemented using a linked list and should have...
using python file and screenshot the file that show up is correct Your input data for each application is: 7 1 8 9 4 2 5 10 6 3 Treat this data as integer data type. Push onto and pop off of each of the input items onto a stack implemented in Python. Identify the item 4 when it is popped off of your stack. 2. Feed this same input data into a Queue implemented in Python. Identify the...
please explain all the steps. I need it ASAP.
i will give u good ratings.
Do in java file Queues are often used to simulate the flow of people, cars, airplanes, transactions, and so on. Write a program that models checkout lines at a supermarket, using the Queue class from the queue.java program (Listing 4.4). Several lines of customers should be displayed; you can use the display, insertſ), and remove() method. You can add a new customer by pressing a...
I NEED HELP WITH THIS HOMEWORK!!!! What is a characteristic of a bag data type? Elements are added and removed in any order Elements are removed in the same order they were added Distinct elements are added in any order but are removed beginning with the last one added Distinct elements are removed in the reverse order they were added Which scenario illustrates a data stack structure Standing in a line to be serviced Filing documents in alphabetical order Offering...
e. public class Queue { // Uses the correct Stack class from ME2
Ex 19 private Stack mStack; public Queue() { setStack(new Stack());
} public Queue enqueue(E pData) { getStack().push(pData); return
this; } public E dequeue() { return getStack().pop(); } public E
peek() { return getStack.peek(); } private Stack getStack() {
return mStack; } private void setStack(Stack pStack) { mStack =
pStack; } }
f. public class Queue extends Stack { // Uses the correct Stack
class from ME2 Ex...