Show the steps of the following operations on a stack

Assignment Help Data Structure & Algorithms
Reference no: EM13944216

1. Show the list configuration resulting from each series of list operations using the List ADT of Figure 4.1. Assume that lists L1 and L2 are empty at the beginning of each series. Show where the current position is in the list.

• L1.append(10);
• L1.append(20);
• L1.append(15);
• L2.append(10);
• L2.append(20);
• L2.append(15);
• L2.moveToStart();
• L2.insert(39);
• L2.next();
• L2.insert(12);

2. Show the steps of the following operations on a stack S of Integers graphically. Assume S is empty initially.

s.push(5);
s.push(3);
s.push(7);
s.pop();
s.push(8);
s.pop();
s.pop();
s.push(10);
s.pop();

3. Show graphically the resulting BST trees after inserting the following same set of numbers in different orders. To find the element 5, how many comparisons would you need for each tree structure? Which one needs the least number of comparisons and which one the most? What conclusion can you make about the searching on BST? Namely, when would the searching time for certain element be the best in the worst cases?

1) {9,6,5,4,7,3,8,1,2}
2) {1,2,3,4,5,6,7,8,9}
3) {9,8,7,6,5,4,3,2,1}
4) {5,9,4,8,3,7,2,6,1}

4. Given the following max heap H, show graphically the results of the following operations on H. Use the same following start state when you perform each operation. (Will put in attached document)

1) H.removeMax();
2) H.insert(15);
3) H.remove(4);

Attachment:- Question 4 max heap H.docx

Reference no: EM13944216

Questions Cloud

How aquinas answers this problem of evil : If God is all good, all-knowing, all-wise, and all-powerful, then how can there be evil in the world? What is your understanding of how Aquinas answers this problem of evil? There are, of course, many other explanations to the problem of evil in a..
Find the value of the liner correlation coefficient : Find the value of the liner correlation coefficient r, and then find the regression equation of  the following table. A company manager wishes to test a union leader's claim that absences occur on the different week days with the same frequencies.
Corporate governance and future strategy : This joint venture has never been far from the news, and in 2008 disputes over corporate governance and future strategy emerged.
How should each pro-posed requirement be evaluated : What is not the focus? How should each pro-posed requirement be evaluated? What critical error must be avoided
Show the steps of the following operations on a stack : Show the list configuration resulting from each series of list operations using the List ADT of Figure 4.1. Assume that lists L1 and L2 are empty at the beginning of each series. Show where the current position is in the list.
Write the objective and constraints equations : Inventory costs them $20 per month per bike, and any shortage costs them $200 in lost profit. It costs $900 to produce a bike. They currently have 26 workers, each capable of producing 105 bikes per month. The workers can produce 20 extra bikes per m..
Confidence interval of mean annual salary of graduates : If the dean wanted a 90% confidence interval of mean annual salary of graduates with width no more than $3,000, how large a sample of graduates would she need?
Dew point of a mixture of hydrocarbons : At a pressure of 10 bar, determine the bubble and dew point of a mixture of hydrocarbons, composition, mol%: n-butane 21, n-pentane 48, n-hexane 31. The equilibrium K factors can be estimated using the De Priester charts in Dadyburjor (1978) or fo..
What is the primary focus of requirements analysis : What is the primary focus of requirements analysis? What is not the focus? How should each pro-posed requirement be evaluated? What critical error must be avoided

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Adt description

Which of the following is not the part of ADT description? Which of the following is true about the characteristics of abstract data types

  Part 1 mining information from sales data is a common task

part 1 mining information from sales data is a common task in both traditional and online stores. past sales

  Draw flowchart and execute the algorithm

Execute the algorithm below using 6 for "number" and Execute the algorithm below using 25 for "number" and draw a flowchart for the algorithm below and have it checked by the TA.

  Algorithm of prim

NFR4: Prim's algorithm should be used to find a minimum spanning tree (see FR6). NFR5: Dijkstra's  algorithm should be used to find a shortest path between two stations (FR7).

  Explaining view of header and footer areas of worksheet

In which view can you see header and footer areas of worksheet?

  Binary tree templated class prepare a binary sort tree

there are really 2 problems1. binary tree templated class. create a binary sort tree templated class that will

  Create a program using c++

Create a program using C++ or Java that will automatically generate x numbers between a range provided by the user? For purposes of this project, the range can be 1-20 and store them in an array.

  Prepare the algorithm to solve the puzzle

Alternating disks you have a row of 2n disks of two colors, n dark and n light.

  Identifying the use cases of the system

Identifying the use cases of the system based on the narrative above, and giving a brief description for each of the use cases.

  Write a program that uses a recursive algorithm to compute

Write a program that uses a recursive algorithm to compute the determinant of a maxtrix. It should read a matrix, print it out, and compute and print the determinant.

  Huffmancodes

You will turn in one file: HuffmanCodes.java, which can encode and decode files using Huffman codes. The program has the following command-line interface:

  Question 1you are required to create a detailed analysis

question 1you are required to create a detailed analysis for each of the following array-based sorting algorithmsa

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd