/// <summary> /// Searches for the pointer containing the given item in the given list recursevely. /// </summary> /// <param name="pointer"></param> /// <param name="item"></param> /// <returns></returns> public SingleLinkItemPointer SearchList(SingleLinkItemPointer pointer, int item) { //End of the list, the item is not in it, return null. if (pointer == null) { return(null); } //Item found, return it's pointer. if (pointer.item == item) { return(pointer); } //Recall this same function passing in the next item in the list linked by the given pointer. else { return(SearchList(pointer.next, item)); } }
public void InsertItem(SingleLinkItemPointer pointer, int item) { SingleLinkItemPointer p; //Temporary pointer. //p = new SingleLinkItemPointer(); }
/// <summary> /// This is a simple list item that points to the next item. /// </summary> public SingleLinkItemPointer(int item, SingleLinkItemPointer nextItem) { this.item = item; this.next = nextItem; }