岛屿数量问题(深度优先)

上个文章写了广度优先的解决方案,实际上用堆栈的方法也能解决code 递归自己就是一种系统堆栈,经过每次递归到系统堆栈为0得到一个岛屿的土地遍历。直接上代码。递归 D_land.h #pragma once bool expand(int x, int y); typedef struct position { int x; int y; }pos; D_land.cpp #include<s
相关文章
相关标签/搜索