View Single Post
  #1 (permalink)  
Old 07-31-2007, 11:03 PM
mathias mathias is offline
Member
 
Join Date: Jul 2007
Posts: 40
mathias is on a distinguished road
I am confused about is the "add" method...
Hi, I am having some major problems with a piece of work involving Java.
We have been giving the following:

Code:
static int add(int chain, int value) // here you need to provide the code that adds a new element to the front of the chain // my solution has four lines ... { return NULL; // this line is only here so you can compile and run the code as is. } // end of method "add"
We are supposed to simulating the "Heap".

Then later we have this:
Code:
static public void main(String args[]) { System.out.println("start of program"); int myChain = NULL; // initialise the chain ... int values [] = {76, 42, 33, 29, 50}; for (int i = 0; i < HEAP_SIZE; i++) { heapArray[i] = new HeapElement(); }; for (int i = 0; i < 5; i++) { System.out.println(myChain = add(myChain,values[i])); } System.out.println("end of program"); }
I need to add the values in the "values" Array into specific random points allocated earlier in the program.

But the bit I am confused about is the "add" method, and the way it is used, specifically, what does this mean?
Code:
myChain = add(myChain,values[i]
Thanks.
Reply With Quote
Sponsored Links