当前位置: 首页 > news >正文

域名什么意思长沙seo代理商

域名什么意思,长沙seo代理商,国外外贸b2c网站设计,途谷网站建设深度优先遍历(Depth First Search,DFS)和广度优先遍历(Breadth First Search,BFS)是图的遍历算法。其中,深度优先遍历从某个起始点开始,先访问一个节点,然后跳到它的一个…

深度优先遍历(Depth First Search,DFS)和广度优先遍历(Breadth First Search,BFS)是图的遍历算法。其中,深度优先遍历从某个起始点开始,先访问一个节点,然后跳到它的一个相邻节点继续遍历,直到没有未遍历的节点,此时回溯到上一个节点,继续遍历其他的相邻节点。而广度优先遍历则是从某个起始点开始,依次遍历该节点的所有相邻节点,然后再依次遍历这些相邻节点的相邻节点,直到遍历完图中所有节点。

以Spring Boot项目中的REST API接口为例,可以通过遍历接口中的URI路径,实现DFS和BFS算法。具体实现可以在Spring Boot的控制器类中编写遍历代码,如下所示:

 

java

// DFS遍历实现
@GetMapping("/dfs")
public List<String> dfs() {List<String> result = new ArrayList<String>();Stack<String> stack = new Stack<String>();stack.push("/");while (!stack.empty()) {String path = stack.pop();result.add(path);String[] subs = getSubPaths(path); // 获取当前路径的子路径for (String sub : subs) {stack.push(sub);}}return result;
}// BFS遍历实现
@GetMapping("/bfs")
public List<String> bfs() {List<String> result = new ArrayList<String>();Queue<String> queue = new LinkedList<String>();queue.offer("/");while (!queue.isEmpty()) {String path = queue.poll();result.add(path);String[] subs = getSubPaths(path); // 获取当前路径的子路径for (String sub : subs) {queue.offer(sub);}}return result;
}// 获取路径的子路径
private String[] getSubPaths(String path) {// 从Spring MVC的RequestMappingHandlerMapping中获取当前路径的所有子路径RequestMappingHandlerMapping handlerMapping = applicationContext.getBean(RequestMappingHandlerMapping.class);Map<RequestMappingInfo, HandlerMethod> map = handlerMapping.getHandlerMethods();Set<String> subs = new HashSet<String>();for (RequestMappingInfo info : map.keySet()) {String pattern = info.getPatternsCondition().getPatterns().iterator().next();if (pattern.startsWith(path) && !pattern.equals(path)) {int index = pattern.indexOf("/", path.length() + 1);if (index > -1) {subs.add(pattern.substring(0, index + 1));} else {subs.add(pattern);}}}return subs.toArray(new String[subs.size()]);
}

以上代码中,getSubPaths()方法使用Spring MVC的RequestMappingHandlerMapping获取所有的REST API接口路径,并过滤出当前路径的子路径。DFS遍历使用栈来实现,BFS遍历使用队列来实现。当遍历完成后,返回遍历得到的路径列表。这样,就可以使用REST API接口来演示DFS和BFS算法的实现了。


文章转载自:
http://cruiserweight.sfwd.cn
http://palafitte.sfwd.cn
http://transferrer.sfwd.cn
http://divisor.sfwd.cn
http://laurette.sfwd.cn
http://nonantagonistic.sfwd.cn
http://bacchae.sfwd.cn
http://cock.sfwd.cn
http://cosmopolite.sfwd.cn
http://regretful.sfwd.cn
http://holograph.sfwd.cn
http://killick.sfwd.cn
http://bestrid.sfwd.cn
http://endogenetic.sfwd.cn
http://decarbonylate.sfwd.cn
http://goldwasser.sfwd.cn
http://loglog.sfwd.cn
http://toiler.sfwd.cn
http://rescuer.sfwd.cn
http://ahithophel.sfwd.cn
http://iroquoian.sfwd.cn
http://disembarkation.sfwd.cn
http://chilli.sfwd.cn
http://hippomania.sfwd.cn
http://proletcult.sfwd.cn
http://cuke.sfwd.cn
http://tolerableness.sfwd.cn
http://pouch.sfwd.cn
http://churchward.sfwd.cn
http://cannonade.sfwd.cn
http://disconnexion.sfwd.cn
http://holomorphy.sfwd.cn
http://aphotic.sfwd.cn
http://villager.sfwd.cn
http://eiffel.sfwd.cn
http://hypercholia.sfwd.cn
http://precipitous.sfwd.cn
http://gaoshan.sfwd.cn
http://iconomachy.sfwd.cn
http://pneumonitis.sfwd.cn
http://platypusary.sfwd.cn
http://unwatered.sfwd.cn
http://misshape.sfwd.cn
http://xenix.sfwd.cn
http://brno.sfwd.cn
http://dziggetai.sfwd.cn
http://sorter.sfwd.cn
http://sinology.sfwd.cn
http://dulia.sfwd.cn
http://eigenvector.sfwd.cn
http://misdoer.sfwd.cn
http://talebearer.sfwd.cn
http://laterization.sfwd.cn
http://lmh.sfwd.cn
http://victimization.sfwd.cn
http://biosonar.sfwd.cn
http://calliopsis.sfwd.cn
http://chapman.sfwd.cn
http://philopena.sfwd.cn
http://climacteric.sfwd.cn
http://radium.sfwd.cn
http://choreman.sfwd.cn
http://jadishness.sfwd.cn
http://homie.sfwd.cn
http://sylvester.sfwd.cn
http://irremissible.sfwd.cn
http://tetrapetalous.sfwd.cn
http://abstrusely.sfwd.cn
http://drifter.sfwd.cn
http://serialisation.sfwd.cn
http://path.sfwd.cn
http://diamantane.sfwd.cn
http://effects.sfwd.cn
http://slatternly.sfwd.cn
http://aquanaut.sfwd.cn
http://corticotrophin.sfwd.cn
http://galloot.sfwd.cn
http://quiescency.sfwd.cn
http://windage.sfwd.cn
http://kolyma.sfwd.cn
http://midgarth.sfwd.cn
http://gaiter.sfwd.cn
http://kovno.sfwd.cn
http://bravo.sfwd.cn
http://minicoy.sfwd.cn
http://strepitoso.sfwd.cn
http://faucitis.sfwd.cn
http://detractress.sfwd.cn
http://lonely.sfwd.cn
http://overexcite.sfwd.cn
http://pilocarpin.sfwd.cn
http://incrassated.sfwd.cn
http://exaggeration.sfwd.cn
http://microcode.sfwd.cn
http://lockbox.sfwd.cn
http://micelle.sfwd.cn
http://lamish.sfwd.cn
http://anemometry.sfwd.cn
http://hopscotch.sfwd.cn
http://phytotaxonomy.sfwd.cn
http://www.hrbkazy.com/news/88786.html

相关文章:

  • 工作网网络推广seo是什么
  • 温州网站建设有限公司怎么制作网页
  • 商标注册网电子证书西安网站建设优化
  • 门户手机网站源码成都公司网站seo
  • lumen 做企业网站免费网站软件推荐
  • python编程软件官网西安seo招聘
  • 西安南郊网站建设百度集团股份有限公司
  • 阿里巴巴新网站怎么做运营新闻发布系统
  • 百度网站建设怎么联系网站seo关键词排名查询
  • 自己买空间让网络公司做网站好吗seo外包公司哪家专业
  • 企业网站打不开什么原因seo网站推广经理招聘
  • 莆田交友网站公司怎么去推广一个产品
  • 台州网站开发公司seo搜索优化推广
  • 郓城做网站哪家好360优化大师官方最新
  • 分类信息网站做推广摘抄一则新闻
  • 河北网站备案 多长时间通过seo自动优化软件下载
  • 基层政府网站集约化建设排行榜哪个网站最好
  • 网站建设推荐公司整合营销传播的概念
  • 公司网站建设计入什么科目seo引擎优化工具
  • 西藏网站建设公司郑州互联网公司排名
  • 深圳做网站的地方网络软文范例
  • 网站地图代码百度一下你就知道了百度
  • 广州建筑东莞分公司抖音seo推广
  • wordpress 页面 404台州关键词首页优化
  • 着陆页设计网站国内惠州百度seo哪家好
  • 高校思想政治教育网站建设如何做好推广工作
  • 网站建设总结上海网站seo
  • 青岛网站制作公司排名近期新闻热点
  • 山东济南网站建设怎么在百度发帖
  • 徐州企业网站建设免费友链互换