30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

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.

Chapter 23 Data Structures and Collections 1197<br />

The binary search tree facilitates duplicate elimination. As the tree is created, attempts <strong>to</strong> insert a<br />

duplicate value are recognized, because a duplicate follows the same “go left” or “go right” decisions<br />

on each comparison as did the original value. Thus, the duplicate eventually is compared<br />

with a node containing the same value.<br />

Classes that implement interface IComparable define method CompareTo, which compares<br />

the object that invokes the method with the object that the method receives as an argument.<br />

Class ArrayList can be used as a dynamic array.<br />

ArrayList method Add adds an Object <strong>to</strong> the ArrayList.<br />

ArrayList method Remove removes the first occurrence of the specified Object from the<br />

ArrayList.<br />

The ArrayList subscript opera<strong>to</strong>r accesses elements of an ArrayList as if the ArrayList<br />

were an array.<br />

Class Stack is provided in the System.Collections namespace.<br />

Stack method Push performs the push operation on the Stack.<br />

Stack method Pop performs the pop operation on the Stack.<br />

Class Hashtable is provided in the System.Collections namespace.<br />

Hashtable method Add adds a key/value pair <strong>to</strong> the Hashtable.<br />

<strong>Program</strong>s can use an IEnumera<strong>to</strong>r (also called an enumera<strong>to</strong>r or an itera<strong>to</strong>r) <strong>to</strong> traverse elements<br />

of an ArrayList one element at a time.<br />

Interface IEnumera<strong>to</strong>r defines methods MoveNext and Reset and property Current.<br />

MoveNext moves the enumera<strong>to</strong>r <strong>to</strong> the next element in the ArrayList. Method Reset positions<br />

the enumera<strong>to</strong>r before the first element of the ArrayList. Property Current returns the<br />

object residing at the current location in the ArrayList.<br />

TERMINOLOGY<br />

Add method of ArrayList IEnumera<strong>to</strong>r interface<br />

ArgumentException IndexOf method of ArrayList<br />

ArrayList class InvalidOperationException<br />

binary tree linked list<br />

BinarySearch method of ArrayList MoveNext method of IEnumera<strong>to</strong>r<br />

Capacity property of ArrayList Peek method of Stack<br />

Clear method of ArrayList Pop method of Stack<br />

Clear method of Hashtable Push method of Stack<br />

collection queue<br />

Contains method of ArrayList Remove method of ArrayList<br />

Contains method of Stack Remove method of Hashtable<br />

ContainsKey method of Hashtable RemoveAt method of ArrayList<br />

Count property of ArrayList RemoveRange method of ArrayList<br />

Count property of Stack Reset method of IEnumera<strong>to</strong>r<br />

Current property of IEnumera<strong>to</strong>r searching<br />

data structure self-referential class<br />

dynamic data structure Sort method of ArrayList<br />

enumera<strong>to</strong>r sorting<br />

GetEnumera<strong>to</strong>r method of IEnumerable stack<br />

GetHashCode method of Object Stack class<br />

Hashtable class System.Collections namespace<br />

IDictionaryEnumera<strong>to</strong>r interface TrimToSize method of ArrayList

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

Saved successfully!

Ooh no, something went wrong!