diff options
| author | Aditya Naik | 2020-06-18 23:39:46 -0400 |
|---|---|---|
| committer | Aditya Naik | 2020-06-18 23:39:46 -0400 |
| commit | c0e0f5072822eb6372a1bd296a554482af97f77b (patch) | |
| tree | 321414dd0a0eb5436e8df12a62c6450f0f3b1412 /10054/necklace.c | |
| parent | 36e8897c90442cd558cdddf3f2ae38f148ac5581 (diff) | |
Diffstat (limited to '10054/necklace.c')
| -rw-r--r-- | 10054/necklace.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/10054/necklace.c b/10054/necklace.c index f1d1e93..aa51236 100644 --- a/10054/necklace.c +++ b/10054/necklace.c @@ -12,7 +12,7 @@ bead *path; int adj[NUM_COLORS][NUM_COLORS] = {{0}}; int path_counter = 0; -int find_path(int x, int y, int curr) +void find_path(int x, int y, int curr) { bead new_bead = {x, y}; path[path_counter++] = new_bead; @@ -37,11 +37,12 @@ int find_path(int x, int y, int curr) } } } + if (found==0) - return 0; + return; curr = (curr+1)%2; find_path(new_x, new_y, curr); - return 1; + return; } int main() @@ -89,8 +90,8 @@ int main() } else { path_counter = 0; - int k=find_path(start_x, start_y, 0); - /* printf("find_path: %d\n", k); */ + find_path(start_y, start_x, 0); + printf("path counter: %d\n", path_counter); for (int x = 0; x < path_counter; x++) { if (x%2 != 0) printf("%d %d\n", path[x].c1+1, path[x].c2+1); |
