Which of the following terms is NOT associated with a stack?
push |
top |
get |
bottom |
Flag this Question
Question 21 pts
Which of the following terms is NOT associated with a queue?
add |
front |
FIFO |
enqueue |
pop |
Flag this Question
Question 31 pts
A stack exhibits what kind of behavior?
Last In, First Out (LIFO) |
First In, First Out (FIFO) |
Last In, Last Out (LILO) |
Read-Only |
Write-Only |
Flag this Question
Question 41 pts
What are the final contents of myQueue after the following
statements are executed?
Queue myQueue = new LinkedList();
myQueue.add( 12 );
myQueue.add( 24 );
myQueue.add( 36 );
int x = myQueue.remove( );
myQueue.add( 48 );
front [12, 24, 36, 48] back |
front [12, 24, 48] back |
front [48, 12, 24] back |
front [24, 36, 48] back |
Flag this Question
Question 51 pts
What are the final contents of myStack after the following
statements are executed?
Stack myStack = new StackInteger>();
myStack.push( 12 );
myStack.push( 24 );
myStack.push( 36 );
int x = myStack.pop( );
myStack.push( 48 );
bottom [12, 24, 36, 48] top |
bottom [12, 24, 48] top |
bottom [48, 12, 24] top |
bottom [24, 36, 48] top |
Flag this Question
Question 61 pts
Which of the following is true about a perfect hash function? (Hint: Try Googling the term.)
The hash code generated is a random number. |
Every time the hash function is called it returns a different value, even for the same object. |
Any two objects that are not "equal" will have different hash codes, but objects that are "equal" will have the same hash code. As a result, no collisions are possible. |
Every hash code generated is a "perfect number." |
There is no such thing as a perfect hash function. |
Flag this Question
Question 71 pts
A HashSet class has been implemented using "open hashing" (i.e. using "buckets") as described in the slides. The average load factor is 2. What is the worst case performance of the 'contains' method?
O( 1 ) |
O( log n ) |
O( n ) |
O( n Log n ) |
O( n2 ) |
Flag this Question
Question 81 pts
What is the expected average performance of the HashSet in the previous question?
O( 1 ) |
O( log n ) |
O( n ) |
O( n Log n ) |
O( n2 ) |
If you post more than 1 question, as pr HomeworkLib guidelined we have to solve only first question.
Ques 1. Answer : (c) get
The push function pushes the new element at the top of the stack.
The top function returns the value of the element at the top without removing the element at the top.
The top function returns the value of the element at the bottom without removing the element at the bottom.
But there is no get function
Which of the following terms is NOT associated with a stack? push top get bottom Flag...
4. Given a stack variable stk which provides a push operation that places an integer o top of the stack, and a pop operation which removes and returns the integer from t top of the stack, what would the stack look like, after the following code executed? for(int k 1; k < 10; k++) if(k % 3 :0) stk.push( k+ stk.pop()); else stk.push( k); 25. Given a queue variable que which provides an add operation which places an integer at...
JAVA LANG PLEASE: I have follwed these below guidelines but when i run my queue test it is not executing but my stack is working fine, can you fix it please! MyQueue.java Implement a queue using the MyStack.java implementation as your data structure. In other words, your instance variable to hold the queue items will be a MyStack class. enqueue(String item): inserts item into the queue dequeue(): returns and deletes the first element in the queue isEmpty(): returns true or false...
JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question 12 pts Which is a valid constructor for Thread? Thread ( Runnable r, int priority ); Thread ( Runnable r, String name ); Thread ( int priority ); Thread ( Runnable r, ThreadGroup g ); Flag this Question Question 22 pts What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds? pause(). sleep(). hang(). kill(). Flag...
Please, answer the three questions. Many thanks 1 Question Which of the following methods does a stack not support? Not yet answered Points out of Select one 1.00 O a. push P Flag question O b. top O C. pop O d. pu 2 Drag and drop an appropriate item (stack, queue, or adapter) into each Question Not yet answered description below. Points out of 3.00 is a container where objects are inserted and removed according to P Flag question...
Complete the code below, test cases to use are at the bottom package Labs; public class ResizingQueue { private final int INITIAL_SIZE = 10; private int [] A = new int[INITIAL_SIZE]; // array to hold queue: front is always at Q[0] // and rear at A[next-1] int next = 0; // location of next available unused slot // interface methods public void enqueue(int key) { //TODO: push the key onto the back of the queue // YOUR CODE HERE! }...
**TStack.py below** # CMPT 145: Linear ADTs # Defines the Stack ADT # # A stack (also called a pushdown or LIFO stack) is a compound # data structure in which the data values are ordered according # to the LIFO (last-in first-out) protocol. # # Implementation: # This implementation was designed to point out when ADT operations are # used incorrectly. def create(): """ Purpose creates an empty stack Return an empty stack """ return '__Stack__',list() def is_empty(stack): """...
Can you please help with the below? 1) Which of the following is true about using a 2-3-4 tree? a. It is designed to minimize node visits while keeping to an O(log n) search performance b. It is designed to self-balance as new values are inserted into the tree c. As soon as a node becomes full, it performs the split routine d. None of the above 2) Which of the following is true about a binary search tree? a. ...
Java Double Max Function I need help with this top problem. The bottom is the assignment // return Double .NEGATIVE-INFINİTY if the linked list is empty public double max return max (first); h private static double max (Node x) f e I TODO 1.3.27 return 0; 1 package algs13; 2 import stdlib.*; 4 public class MyLinked f static class Node public Node() t 1 public double item; public Node next; 10 int N; Node first; 12 13 14 public MyLinked...
In problem 3, you will write a function, findvertically (), which will determine whether or not a given word exists in a word search puzzle vertically. In word search puzzles, words can be written upwards or downwards. For example, "BEAK" appears at [1] [3] written downwards, while "BET" appears at [2] [2] written upwards: [["C", "A", "T", "X", "R"], ["D", "T", "E", "B", "L"], ["A" "R" "B", "E", "Z"], ["X", "O", "E", "A", "U"], ["J", "S", "O", "K", "W"]] Your...
Please help me solve this question using Excel data!! (attached on bottom) Thank you!!! Question 2 5 pts Continuing with our data visualization, create a scatterplot with the total number of check-ins (TotCheckins) on the y-axis and the average ratings (AvgRating) on the x-axis. Be sure that the equation for the trend line and the r value are shown on the scatterplot. While your plot may be different aesthetically, which of the following is an accurate representation of the data?...