-
Jan 4th, 2002, 08:29 AM
#1
Thread Starter
Hyperactive Member
-
Jan 4th, 2002, 11:48 AM
#2
Create an enum of names, then create a simple global array with that many elements, set them all to zero.
Code:
Public enum names
name1
name2
... ad nauseum
end enum
Public arr(100) as Integer
For x = 0 to name64
arr(x)=0
next x
..............
'as each name comes up
' check to see
if arr(name) >0 then
Exit Sub ' quit the alogorithm
else
arr(name )=1
end if
-
Jan 4th, 2002, 12:06 PM
#3
Thread Starter
Hyperactive Member
-
Jan 4th, 2002, 02:24 PM
#4
I used a boolean array recently to check if a node on a tree had been dealt with.
VB Code:
Public Trail() as Boolean
....
....
....
NumNodes = LoadTree(Filename") 'returns number of nodes unsurprisingly!
Redim Trail(1 to NumNodes) as Boolean
....
....
....
'inside recursive function
if Trail(Whatever) then
CollapseRecursion = True 'a public flag to kill recursion upon finding a repetition.
Else
DealWith(Whatever)
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|