יום ראשון, 2 באוקטובר 2011

The CatchUp- Part 1

I went back to my previous post and attempted the last exercise and noticed how simple it was. I therefore managed to successfully modify LinkedListTest_Application to incorporate the new methods I made before.
-------------
Here's my recursiveFind method. Wasn't a problem at all.


public ListNode recursiveFind(ListNode list, Object goal){
 if (goal.toString().compareTo(list.getData().toString()) == 0){return list;}
 if (list.getData().toString().compareTo(goal.toString()) == 1){return null;}
 return recursiveFind(list.getNext(), goal);
}

Here is my recursive Length method.  Not a problem either.

public int recursiveListSize(ListNode list){
int count = 0;
if (list.getData()==null
{return count;}
{count++;}{return recursiveListSize(list.getNext());}
}

for 3_8 I couldn't think of a good way to approach this. The only thing i thought of doing was doing a count, putting the data on an array and then printing that backwards, but I felt like that was somewhat, cheap.

------------
CircularListNodes wasn't tough, it was pretty straight forward. I have it coded on my Eclipse workspace.
3_11 Having an end node complicates it for me and I get confused however it saves you a bunch of coding lines which you can ignore, but I would prefer writing those lines rather than to get confused.

------------
All I want to say at this stage is that a DoubleList is something beautiful and I wish I knew about it earlier.


3_12-3_14 I did, but I wish there were more specifications so I could know if my  method is right or wrong.


------------
LINKED LIST APPLICATION.


Mr Daly - I would just like to say that I spent about 10 minutes trying to fix your spelling mistakes in your code which gave me errors. It drove me mad.


I am now on 3_16 and can't keep my eyes open, I will continue my catchup mission tomorrow.




אין תגובות:

הוסף רשומת תגובה