1. Engineering
  2. Computer Science
  3. java the first two are to rewrite methds in java...

Question: java the first two are to rewrite methds in java...

Question details

[JAVA] The first two are to rewrite methds in Java, the 3rd one deals with heap referencepoint and nodes I believe.

l. Rewrite the following Java method in a functionally equivalent way that does not use any recursion. void f (int n) 1 System.out. println(n); if (n 1) if ((n & 1) e) f(n/2); else f (3*n+1 2. Rewrite the following Java method in a functionally equivalent way that does not use any loop int f(int a int k) f int i -1; for (int j 0; j a length; j++) if (a[j] k) i return i 3. A Java class is defined as class Node Node next; In the following program fragment, determine the reference counts for the three Node objects at the end of each line. 1. Node p new Node 2 Node q new Node 3 Node r new Node 4. p next q; 5. q.next E r, 6. r next p; 7. p q r null

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution