Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

PART I: Short Response

Directions: Answer each of the following questions. Please ensure that your responses are at least 3 to 5 sentences in length.

1. A function int MaxStack (stackclass S); will return the largest value in an ADT stack of integers. Write the code for this function. Note: your function will be a client of the ADT, not a part of it, so you must use the ADT operations to access the stack. You can assume the copy constructor for the stack has been implemented.

2. Suppose you are asked to create a new method for the stack class, PopN, defined as follows:

PopN(S, n)

{ Removes from stack S the n number of items that were
most recently added. It is an error if there are
fewer than n items on S. }

To implement this operation, you could either modify the stack directly or use the existing Pop operation. What would be the advantages and disadvantages of each method?

3. Write a code segment using class queueClass that creates a queue of the integers 1-5.

4. Write a member function called Display that displays the elements of an object of type queueClass. Assume the pointer-based queue is in use, and note that you are writing a member function of the class, so you have access the private data members.

5. What is the difference between a time-driven simulation and an event-driven simulation?

6. Consider class wheel and class automobile. An automobile has-a wheel. Write a class relationship between these classes that reflects this relationship. Details of other members are not important.

7. Why are constructors not inherited?

8. What is a virtual function? What is its purpose?

9. What is the difference between a virtual and a pure virtual function? What is an abstract class, and what is its purpose?

10. The approximate number of iterations of an algorithm with data size N is determined to be:

1 + 2 + 3 + ... + N

a. Write a table that shows N and the number of iterations for the first 10 values of N.
b. What is the O-notation for this algorithm?

11. The best and worst case performances of MergeSort are the same, while for QuickSort the best and worst cases widely differ. Explain why.

12. Given the ADT binary tree operations defined in this chapter, draw the tree or trees produced by the following sequence of statements:

typedef int treeItemType;
binTreeClass R, S;

S.SetRootData(10);
S.AttachLeft(5, Success);
S.AttachRight(6, Success);
S.LeftSubtree().AttachRight(2, Success);
S.LeftSubtree().RightSubtree().AttachLeft(20, Success);
S.LeftSubtree().RightSubtree().AttachRight(15, Success);
S.RightSubtree().AttachRight(13, Success);
R.SetRootData(1);
R.AttachRight(8, Success);

binTreeClass T(9, S, R);

13. Suppose the following values are to be inserted into a binary search tree:

A, B, C, D, E, F, G

Inserting the values in different orders results in different shapes of trees. What ordering results in an optimal (complete) tree? Show the resulting tree.

14. Explain how a stack could be used to completely search a graph without using recursion.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91900022
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As