hi,
can somebody answer this ?
why is this so slow or how to speed this up?
on Windows:
Permutations 0:2
Rows 3:48
all Rows 3:48
on OSX:
Permutations 0:3
Rows 9:41
all Rows 9:41
can somebody answer this ?
why is this so slow or how to speed this up?
B4X:
Dim dt,dt1 As Long
dt=DateTime.now
Dim l As List = perm.permute("123456789")
dt1=DateTime.now
Log("Permutations "& DateUtils.PeriodBetween(dt,dt1).Minutes&":"&DateUtils.PeriodBetween(dt,dt1).Seconds)
dt=DateTime.now
For i = 0 To l.Size -1
Dim RowCol As List
RowCol.Initialize
RowCol=Regex.Split("",l.Get(i))
If RowCol.Get(0)+RowCol.Get(1)+RowCol.Get(2) = 23 And _
RowCol.Get(3)+RowCol.Get(4)+RowCol.Get(5) = 15 And _
RowCol.Get(6)+RowCol.Get(7)+RowCol.Get(8) = 7 And _
RowCol.Get(0)+RowCol.Get(3)+RowCol.Get(6) = 11 And _
RowCol.Get(1)+RowCol.Get(4)+RowCol.Get(7) = 20 And _
RowCol.Get(2)+RowCol.Get(5)+RowCol.Get(8) = 14 Then
dt1=DateTime.now
Log("Rows "& DateUtils.PeriodBetween(dt,dt1).Minutes&":"&DateUtils.PeriodBetween(dt,dt1).Seconds)
dt1=DateTime.now
End If
Next
Log("all Rows "& DateUtils.PeriodBetween(dt,dt1).Minutes&":"&DateUtils.PeriodBetween(dt,dt1).Seconds)
on Windows:
Permutations 0:2
Rows 3:48
all Rows 3:48
on OSX:
Permutations 0:3
Rows 9:41
all Rows 9:41
Attachments
Last edited: