Lecture 12

The system cycles through all users over and over

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ty list Basic use: Time sharing computer. The system cycles through all users over and over again. 5 6 Problem: There is no more NULL pointer. How do we know that we are at the end of the linked list? head 2 4 6 7 4 8 When are we at the end? if (cur = = List) then we are at the end !!! List 2 Solution: Have the head pointer point to the last element. This has a surprising side benefit: I have now easy access to the last AND the first element. How do we get the first element? WITHOUT LOOPING 6 List next points to the next element. 9 DUMMY HEAD NODES Basic idea: Put an “empty node” before the first node. Now, for insert and delete, we can point with “prev” to the empty node, and with “...
View Full Document

This document was uploaded on 03/31/2014 for the course CS 114 at NJIT.

Ask a homework question - tutors are online