ابزارهای برنامهنویسی ویژوال بیسیک 6
A Visual Basic 6 Programmer’s Toolkit
معرفی کتاب «ابزارهای برنامهنویسی ویژوال بیسیک 6» (با عنوان لاتین A Visual Basic 6 Programmer’s Toolkit) نوشتهٔ Hank Marquis, Eric A. Smith (auth.)، منتشرشده توسط نشر Apress L. P. در سال 2000. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Chapter 1 Personally, we find the Quick Sort algorithm to be the easiest sort algorithm to implement just about anywhere that a fast and efficient sorting algorithm is Although the Quick Sort sort is usually the best general-purpose sort for most large arrays, special care must be taken ifthe data is likely tobe mostly presorted before QuickSort is applied. required. It's easily customized for different data types (integer, long, double, variant, etc.), as well as being able to sort a Grid or a user-defined type (UDT) with a little magic! To sort data regardless of type, you can create an implementation that declares parameters of type Variant. To maximize performance, you should declare the parameters with their proper types (i.e., long, integer, string, etc.) You have just one "gotcha" to keep in mind: the Visual Basic Option Base directive. Option Base controls whether the indexing of array elements begins at 0 or 1. The default is 0. This means that if you create an array such as: Dirn AnArray(lO) then, by default, your array will have 11 elements numbered 0 through 10. Because the human brain tends to find this scheme unnatural, unexpected errors can creep into your sorting routines and other array-handling code. Therefore, if you are writing generat purpose array handling code, it is especially important to use the built-in array bounds functions LBound and UBound to determine the lower and upper bounds of an array. The code in Listing 1-2 shows a simple Quick Sort implementation. Listing 1-2 is a recursive Quick Sort and has a minimum of code, which is commented to explain the basic concept of the Quick Sort. Private Sub QuickSort(anArray As Variant, \_ StartEl As Long, StapEl As Long) Dirn workStart As Long, workStop As Long Dirn X As Long, Y As Long, I As Long workStart = StartEl workStop = StapEl ' Get the halfway point and assign it to X X= anArray((StartEl +StapEl) I 2) ' X now holds value of the array itern that is ' halfway between StartEl and StapEl. The next stop ' is to cornpare the rank of workStart to workStop ' to deterrnine when workStart (the lbound value) ' equals or exceeds workStop (the ubound value). While (workStart
دانلود کتاب ابزارهای برنامهنویسی ویژوال بیسیک 6