What are the benefits we accrue by using a java interface


What makes a program easy to modify?Describe the order of magnitude of the following code section using Big(O) notation.

j = 1;
While (j < N)
{
j = j * 2);
}

What are the benefits we accrue by using a Java interface construct to formally specify the logical level of ADTs?Suppose we have a linked list of Strings, as defined in the textbook, named presidents. Suppose it contains three nodes, with the first node holding "Adams", the second node "Washington", and the third node "Kennedy". What would be output by the following code:

LLStringNode temp = presidents;
while (temp != null)
{
temp = temp.getLink();
}
System.out.println(temp.getInfo());

Suppose a collection object is defined to hold elements of class Object, and you use it to store String objects. Describe what you must do when you retrieve an object from the collection and intend to use it as a String.

Show what is written by the following segment of code, given that item1, item2, and item3 are int variables, and stack is an object that fits our abstract description of a stack. Assume that you can store and retrieve variables of type int on stack.

item1 = 1;
item2 = 0;
item3 = 4;
stack.push(item2);
stack.push(item1);
stack.push(item1 + item3);
item2 = stack.top();
stack.push (item3*item3);
stack.push(item2);
stack.push(3);
item1 = stack.top();
stack.pop();
System.out.println(item1 + " " + item2 + " " + item3);
while (!stack.isEmpty())
{
item1 = stack.top();
stack.pop();
System.out.println(item1);
}

7. Explain the relationship between dynamic storage allocation and recursion.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: What are the benefits we accrue by using a java interface
Reference No:- TGS01243822

Expected delivery within 24 Hours