What stages of computation does garbage collection

Assignment Help Computer Engineering
Reference no: EM1329845

class Node
{
int value;
Node next;
Node(int value, Node next)
{
this.value = value;
this.next = next;
}
Node(int value)
{
this.value = value;
}
}
class List {
Node start;
void inverse()
{
Node p = null;
for (Node q = start; q != null; q = q.next)
{
p = new Node(q.value,p);
}
start = p;
}

Please provide answers to the following questions based on above Java classes.

1. For a list with n Nodes, what is the maximum number of nodes that are "live" (i.e., accessible from a "root set" of variables) during the method inverse(), and when does this maximum occur?

2. Give a simple modification of the method inverse() above that minimizes the number of "live" nodes that are necessary for the method to work, so that any item that will not be used later can be immediately reclaimed as "garbage."

3. Suppose there is "heap space" for 10,000 nodes as Java objects and a list of 7,000 nodes which are stored in that heap. When method inverse() with the modification in (2) is applied to that list, at what stages of the computation does garbage collection take place?

Reference no: EM1329845

Questions Cloud

Write down java application to accomplish : Ask users for the past 5 years of federal taxes they have paid, save this data to an array, search for largest and the smallest amount of tax, and display it to screen.
Freedom of religion amendment guarantee : What are those two guarantees and how do they differ?
Discuss the firms from a strategic perspective : In a narrative format, discuss these firms from a strategic perspective.
Explain why is strong home currency mitigate : Explain why is strong home currency mitigate the growth of inflation rate locally
What stages of computation does garbage collection : For a list with n Nodes, what is the maximum number of nodes that are "live" (i.e., accessible from a "root set" of variables) during the method inverse(), and when does this atmost occur.
Change and leadership characteristics : Change and Leadership Characteristics - Describe a change Discuss the kinds of leadership characteristics you believe are necessary to successfully mange change in organization for the next decade.
What do you think the increase in productivity : What do you think the increase in productivity is likely to move the economy closer to full-employment or farther away.
The success of an organization in meeting : Why is Strategic Recruitment critical to the success of an organization in meeting its goals and mission?
Imperfect market conditions : Imperfect market conditions exist in the real-world of corporate finance.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Explain if statement, a switch statement, or a combination

Do you think it would be better to set this up as an if statement, a switch statement, or a combination? Write down the code if it helps to explain your answer.

  What is the proposed solution

At is the definition of run-time errors. What is the proposed solution.

  Avoiding breaches in health care information system

Analyze the financial and privacy impacts of the breaches to health care information systems and make at least two recommendations in order to prevent such breaches in future.

  Define the quicksort algorithm to sort vector v

define the quicksort algorithm to sort vector v. During each pass, list all exchanges of a pair of elements in the lower and upper sublist.

  How to write a program to check the collision

How to write a program to check the collision Write down a java program to check if they will collide or not. If they are going to collide print a message that 'The crafts will collide at (x,y)' where co-ordinates (x,y) are on Map as points of co..

  Introduce relationship sets or additional entity sets

Introduce relationship sets or additional entity sets

  Developing the circuitry for class project

If number is divisable by 4 or 5, number has to be a multiple of 2 in order to generate an output. If the number is devisable by 3, it has to be a multiple of 3 and 5 to generate an output.

  Program for converting infix expressions into postfix form

Write a program which will transform the infix expressions into the postfix form and then determine the resulting postfix expression.

  Application showing sizes of two files and their ratio

Build a file which consists of your favourite movie quote. Make a use of a text editor like Notepad and save file as Quote.txt. Copy contents of the file and paste them into the word-processing program like Word. Save file as Quote.doc. Write down..

  What frustrations with computer capabilities today

What frustrations do you have with computer capabilities today.

  What is csma/cd

What do you feel is the future for Token Ring? What are its advantages or disadvantages.

  Write down the definitions for a double-stack structure

Write down the definitions for  a double-stack structure

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