Lecture 11

null x cur prev next cur next success boolean1 else

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: ur != NULL) && (X = = cur prev next = cur next; Success = boolean(1); } else Success = boolean(0); data)) { 5 4 What if we are trying to delete at the beginning? Then prev = NULL and prev next will crash. We just have to change “head”. if (prev != NULL) prev next = cur next; else head = cur next; 6 if ((cur != NULL) && (X = cur if (prev != NULL) prev next = cur next; else head = cur next; Success = boolean(1); } else Success = boolean(0); data)) { Step 3: After deleting, cur will still point to the record that we deleted. From the point of view of the linked list, it has been deleted, but it still tak...
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