`
shuishou119800
  • 浏览: 7685 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
算法说明: 用1、2、2、3、4、5这六个数字打印出所有不同的排列,如:512234、412345等。要求:"4"不能在第三位,"3"与"5"不能相连    算法代码: public class PermutationAlgo { private int count = 0; public void ...
 算法说明: 在屏幕上打印如下结果:   int i=5;    1   2   3   4   5   16  17  18  19   6   15  24  25  20   7   14  23  22  21   8   13  12  11  10   9     int i=6    1   2   3   4   5   6   20  21  22  23  24   7   19  32  33  34  25   8   18  31  36  35  26   9   17  30  29  28  27  10    ...
前两天写了一篇文章,分析了“内螺旋矩阵算法”的实现,讨论到了面向对象编程的可扩展性,于是今天用桥梁模式将代码做了些改造,具体如下: package com.algo; class Position { private int x; private int y; public Position(int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public void setX(int x) { this.x = x; } ...
Global site tag (gtag.js) - Google Analytics