Reference no: EM131144242
Data Structure and Algorithm
Question 1:
Stacks and queues are two ways to store data in a linear fashion.
a. Describe the major difference between a stack and a queue.
b. The picture below is of a coffee cup dispenser. Is it a stack or a queue? Explain. (Hint : LIFO or FIFO)
Question 2:
Using the stack algorithm for computing Post fix expressions, trace the algorithm on the Post fix expression below, showing the stack at the end of each iteration of the loop. (As given on Slide#29 & #30)
(Draw a separate picture of the stack each time, so we can see the overall process of the algorithm.)
Question 3:
You have already created Java project name Algorithm within same project create package name npu.dataStructure.stack and write a class name TheStack with following methods implimantation.
//constructor
public TheStack(int stackSize){ //your code here}
public void push(Object obj){ //your code here } public Object pop(){//your code here }
public Object peek(){//your code here } public boolean isEmpty(){//your code here } private boolean isFull(){//your code here }
public void displayStack(){//your code here }
create another class which will have main method to test TheStack class. Push some Strings in the stackand display the stack. pop all strings out of the stack. Display stack - it should give you message that stack is currently empty. Pop one more extra string from stack - it should give you message indicating that you are trying to pop String out of stack when its empty.
Question 4:
You have already created Java project name Algorithm within same project create package name npu.dataStructure.queue and write a class name TheQueue with following methods implementation.
//constructor
public TheQueue(int capacity){//your code here}
public void insert(Object value){ //your code here}} public void remove(){//your code here}
public void peek(){//your code here}
public int size(){//your code here} //displays current elements in the queue
public boolean isEmpty(){//your code here} public boolean isFull(){//your code here }
public static void displayTheQueue(){ //your code here}
Prepare the journal entry to record the write off
: What is the cash realizable value of the accounts receivable (1) before the write-off and (2) after the write-off?
|
How his news affected flow time after completed construction
: After completing construction of a new building, we discovered our inventories are about 40% of what they were 3 months ago.- how has this news affected flow time after the completed construction and by how much?
|
Prepare the journal entry to record the estimated
: Prepare the current assets section of the balance sheet for Henley Company. Assume that in addition to the receivables it has cash of $90,000, merchandise inventory of $130,000, and prepaid expenses of $7,500.
|
Determine an equation of the tangent line
: Determine an equation of the tangent line to y = e-3x at (0, 1). Differentiate the implicit function 2yex + 1 = x and Locate any relative extrema and points of inflection for f(x) = x2ln(x)
|
How does the home agent accomplish this interception
: Describe the major difference between a stack and a queue - Using the stack algorithm for computing Post fix expressions, trace the algorithm on the Post fix expression below, showing the stack at the end of each iteration of the loop.
|
Record the following transactions on the books of keyser
: On July 1,Keyser Co. sold merchandise on account to Maxfield Inc. for $15,200, terms 2/10, n/30.
|
Write a paper on biometrics and their use for recognition
: Write a paper on Biometrics and their use for Recognition. Sections one and two are observations that you can verify. The third portion is possible developments of the technology.
|
Why such a restriction might make the team owners better off
: Professional sports leagues often have salary caps that limit the amount individual teams can pay players. Using the prisoner's dilemma game, explain why such a restriction might make the team owners better off.
|
Why use the sharedprefences class
: What are some of the best practices when working with files on the Android file system? What is the top-level directory for storing Android application data on the Android file system? Why use the SharedPrefences class?
|