יום ראשון, 11 בספטמבר 2011

Linked Lists Student Tasks 1-6

Student task number one disappointingly confused me a lot.
I managed to get task number two; I know it is not a huge accomplishment because it is quite basic, but it's a start.

public ListNode findInOrderedList(Object goal)
{
  if(listEmpty()){return null;}
  ListNode temp = list;
  while (!(temp.getData().toString().compareTo(goal.toString()) == 1)) // condition that its still in the part that is smaller or equal to it
    {
        if (goal.toString().compareTo(temp.getData().toString()) == 0)
        return temp;
        else
        temp=temp.getNext();//move on to node 2
       }
  return null;
}

Task three took a while, but Amit helped me with it, and I finally understood it. This helped me a lot with the syntax of linked lists and their logic.


public void deleteFromList(Object goal)
 {
if (findInOrderedList(goal) == null) {return;}
else {
ListNode temp = list;
if (goal.toString().compareTo(temp.getNext().getData().toString()) == 0)
temp.setNext((temp.getNext()).getNext());
else
temp = temp.getNext();}
 }

I am not sure why, but the link for task 4 was blocked for me, I am not sure what I was supposed to do, but it didn't seem like such a necessity.

Task 5&6: I honestly was not very sure what was going on. I know realize I need help.

The following week's work is about halfway done, I will post it when I'm done, hopefully in the next day or two. I know I am behind, and it's a little bit frustrating, but I'm catching up.