commit 44beaa88e54d60d5c576380534cf5ebb8dd44709
parent 1a90075f672a442cafa35c1cccbb6cf026c3980e
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date: Mon, 15 Nov 2021 07:41:24 +0100
Fixed used of uninitialized aux variable
Diffstat:
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/TODO.md b/TODO.md
@@ -40,6 +40,9 @@ It's more of a personal reminder than anything else.
## Technical stuff
+### Better pruning tables
+* Use pruning values mod 4 instead of mod 16
+
### Code simplification
* Remove anti-indeces. I think I can do this by using an iterative deepening
dfs method for generating pruning tables, like I do in solve()
diff --git a/nissy-2.0beta2.tar.gz b/nissy-2.0beta2.tar.gz
Binary files differ.
diff --git a/src/utils.c b/src/utils.c
@@ -159,12 +159,16 @@ is_perm(int *a, int n)
{
int *aux = malloc(n * sizeof(int));
int i;
-
+
for (i = 0; i < n; i++)
+ aux[i] = 0;
+
+ for (i = 0; i < n; i++) {
if (a[i] < 0 || a[i] >= n)
return false;
else
aux[a[i]] = 1;
+ }
for (i = 0; i < n; i++)
if (!aux[i])