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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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