last time: redim
resize an array
using a for each loop
For Each letter in sentence.ToCharArray()
If (letter >= "A") And (letter <= "Z") Then
index = Asc(letter) - 65 'The ANSI value of "A"is 65
charCount(index) += 1
End If
Next
how freq table might be useful
huffman trees
http://en.wikipedia.org/wiki/Huffman_coding
AN example of using freq tables
"If arrayOne() and arrayTwo() have been declared with the same data type, then the statement
arrayOne = arrayTwo
makes arrayOne() an exact duplicate of arrayTwo(). It will have the same size and contain the same information.
"
This comment is false. fixed in later versions of the book
so, how DO we copy an array?
two ways:
1)
Dim a(4) As Integer = {6, 8, 2, -8, 0}
Dim b() as Integer
' i want to make b an exact duplicate of a
ReDim b(UBound(a))
For I = 0 to UBound(a)
b(i) = a(i)
Next
2)
b = a.Clone()
HW: arrays, creating and accessing
q 28, 32
No comments:
Post a Comment