Live nodes and garbage collection in java

Assignment Help JAVA Programming
Reference no: EM13940737

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: EM13940737

Questions Cloud

Determine the speed at which the clutch starts to engage : Determine the speed at which the clutch starts to engage, the power transmitted at a speed of 1500 rpm.
Record acquisition of the building and the delivery truck : Record the acquisition of the building and the delivery truck. Compute and record the amortization expense on the patent for 2009 on a straightline basis.
What will be extension of the spring at a rotational speed : A body of mass 1 kg is whirled in a horizontal plane at the end of a spring. The spring stiff ness is 5 kN m 1 and the initial distance from the centre of rotation to the centre of the body is 200 mm. What will be the extension of the spring at a ..
What primary factors that contribute to wrongful conviction : Briefly identify your working solution to the problem. How might your working solution solve the problem? Be sure to note here that your working solution will evolve through continued research and analysis.
Live nodes and garbage collection in java : 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?
Importance of decision-management activity : Has what you have learned in this subject created an increased awareness of the importance of decision making as a management activity? Why or why not?
Main stakeholders in the mg rover business : Set out the main stakeholders in the MG Rover business at the time of its collapse. How would you determine the relative importance of their stake?
Annual interest rates on comparable investments : If annual interest rates on comparable investments are 3.5%,(a) What would be a reasonable price to pay for an annuity paying £17,500 a year for the next 25 years?
Determine the rotational speed at which the wire will break : The distance from the centre of rotation to the centre of the mass is 1.5 m and the diameter of the wire is 2 mm. If the ultimate tensile strength of the steel is 500 MPa, determine the rotational speed at which the wire will break.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Calculates the product of the following sequence

Write a java code that calculates the product of the following sequence of numbers using for/loop and do/while/loop

  Which announces whether or not the player has won the game

2D graphics, instead of text, to display the Xs and Os in the grids of the square- shaped buttons decision logic or recursion in order to determine whether or not a player wins the games. Display a message which announces whether or not the player ha..

  Personalize the time zone application of section 24.3

Personalize the time zone application of Section 24.3. Prompt the user to log in and specify a city to be stored in a profile. The next time the user logs in, the time of their favorite city is displayed automatically.

  Program mimics a rudimentary spreadsheet

Change the averages so that they are rounded to the nearest one hundredth. The example above shows averages in format - Change the program so that before the spreadsheet window is displayed, the user sees the window

  Develop a java based gui application

Develop a Java based GUI application(using swing) that allows the user to enter Charity/Fund information and display them in a JTable

  Eliminate the last comma in the string output

Eliminate the last comma in the String Output which includes array output values from "hourlyTemp[i]" (entire list). My guess is that this needs to incorporate "%d" somehow but my online book won't accept the use of "%d" for some reason. From the boo..

  Write a recursive public method

Write a recursive public method in our BST class that returns a reference to the information in the node containing the smallest value in the tree. The signature of the method is

  Provide java code for a method

Provide Java code for a method that would perform functionality of your choice. Try to create functionality that is unique - something that you could use. Be sure to include an example call to your method and explain the code you developed.

  The williamsburg women''s club

The Williamsburg Women's Club offers scholarships to local high school students who meet any of several criteria. Write an application that prompts the user for a student's numeric high school grade point average (for example, 3.2), the student's num..

  Implementation of tru file system

Design and implement TFS. It is a file system that can be used on a standalone machine. There are several simplifying assumptions such as a single application is accessing the file system at any given time.

  A class is a blueprint for an object

A class is a blueprint for an object. A class may have a default constructor, a constructor with arguments, accessor methods, mutator methods, public fields, and private fields.

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