Describe three uses of the tree structure as a way of organizing information tha
ID: 3783586 • Letter: D
Question
Describe three uses of the tree structure as a way of organizing information that you are familiar with. Some aspect of each of the following can be modeled with a graph structure. Describe, in each case, what the nodes would represent and what the edges would represent. Travel routes available through an airline Countries and their borders A collection of research articles about data structures Actors (research the "six degrees of Kevin Bacon") The computers at a university The Web What is an alias? Show an example of how it is created by a Java program. Explain the dangers of aliases. Assume that date1 and date2 are objects of class incDate as defined in Section 1.4. What would be the output of the following code? Date1 = new IncDate(5, 5, 2000): date2 = date1: System.out.println(date1): System.out.println(date2): date1.increment(): System.out.println(date1): System.out.println(date2): What is garbage? Show an example of how it is created by a Java program. Assume that date1 and date2 are objects of class IncDate as defined in Section 1.4. What would be the output of the following code? Date1 = new IncDate(5, 5, 2000): date2 = new incdate (5, 5, 2000):Explanation / Answer
37.A tree is data structure is tool for organising data objects based on keys.
The uses of tree data structure
38.
a)
Edges: Travel routes
Nodes: Airports
b)
Edges: Borders
Nodes: countries
c)
Edges: data structure
Nodes: research articles
e)
Edges: branches in university
Nodes: computers
f)
Edges: Types of files
Nodes: file names
38)
Aliasing :
When a person uses two names, it's called aliasing. Same thing with objects i.e When two variables are aliased, any changes that affect one variable also affect the other.
Disadvantages of alias:
1)we have confusing very fast.
2)Debugging is became very difficult.
40)
//creating IncDate class
date1=new IncDate(5,5,2000);
//aliasing date1 to date2 object
date2=date1;
o/p:
5-5-2000
5-5-2000
6-5-2000
6-5-2000
41)
In java using garbage collector we have cleared unnecessary memory in runtime i.e garbage means nothing but unreferenced objects. The below program explains it
public class TestGarbage{
public void finalize(){System.out.println("object is garbage collected");}
public static void main(String args[]){
TestGarbage s1=new TestGarbage1();
s1=null;
System.gc();
}
}
o/p:
object is garbage collected
42)I think nothing display but we have created date1 and date2 objects of IncDate class containg same value is 5-5-2000
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.