VISUAL BASIC 2005 EXPRESS: NOW PLAYING

To provide greater flexibility in storing information, Visual Basic includes three data structures called queues, stacks, and hash tables, which, as with arrays and collections, do nothing more than store data in a list. However, they offer different ways to search, store, and remove data, which can make them more useful than arrays or collections, depending on what you want your program to do.

Using a Queue
A queue always adds data to the end of a list but removes data from the front of the list. A queue takes its name from the way it stores and removes data, which mimics the way people wait in line: the first person in line is the first one to leave. Because of the way a queue adds and removes data, queues are sometimes called a First In, First Out (FIFO) data structure.

A queue can be useful for creating an inventory program in which you want to remove the oldest stored item first. If you were to use a different data structure, such as a collection, to remove an item, old items could be left sitting idly by or rotting away in your inventory, which would waste your company’s resource.

Get download pdf VISUAL BASIC 2005 EXPRESS: NOW PLAYING

Related Tutorial

Tags: , , , , , , , , , , ,

Comments

Comments are closed.