30.08.2014 Views

Arete Zafiriou - Student.cs.uwaterloo.ca

Arete Zafiriou - Student.cs.uwaterloo.ca

Arete Zafiriou - Student.cs.uwaterloo.ca

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Until Curnode == None, you have reached the end of the list<br />

<br />

23 <br />

9 14 17 <br />

Searching for an item in SLL<br />

Traverse the list<br />

Produce true if the item is in the list<br />

Produce false otherwise<br />

Inserting items in a SLL<br />

Insert(27)<br />

Node<br />

17 <br />

head <br />

Beginning of the list<br />

head <br />

New node<br />

27 <br />

17 <br />

newNode._next = head<br />

head = newNode<br />

1. newNode._next=head<br />

head = newNode<br />

2. head=newNode<br />

newNode._next = head<br />

Inserting in the middle of the list<br />

<br />

9 <br />

17 14 52 <br />

1 <br />

2 <br />

curNode 27 <br />

newNode

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!