- 博客(6)
- 收藏
- 关注
原创 动态绑定
class Father {int age=10;public static void f1(){System.out.println(“father static”);}public void f2(){System.out.println(“father method”);}}class Son extends Father {int age=11;public st...
2019-06-02 17:45:10
110
原创 Java各代码块运行顺序
各代码块运行顺序A:看程序写结果class Student {static {System.out.println(“Student 静态代码块”);}{System.out.println(“Student 构造代码块”);}public Student() {System.out.println(“Student 构造方法”);}}class Demo2_St...
2019-06-02 17:32:38
243
原创 八皇后位置放置问题
“`includeusing namespace std;define N 8int column[N+1]; int rup[2 * N + 1]; //副对角线 int lup[2 * N + 1]; //主对角线 int queen[N + 1] = { 0 }; int num = 0;void backtrack(int); void ...
2018-08-16 10:35:37
347
原创 递归求二叉树的度
int TreeDepth(BinaryTreeNode* pRoot){ if(pRoot == NULL) return 0; int nLeft = TreeDepth(pRoot->m_pLeft); int nRight = TreeDepth(pRoot->m_pRight); return (nLeft > nR...
2018-07-31 15:14:55
441
原创 C++实现约瑟夫环
// ====================方法1====================int LastRemaining_Solution1(unsigned int n, unsigned int m){ if(n < 1 || m < 1) return -1; unsigned int i = 0; list<in...
2018-07-31 15:04:02
2208
原创 c++实现堆排序
include include using namespace std;//辅助交换函数 void Swap(int &amp;a, int &amp;b) { int temp = a; a = b; b = temp; }//堆排序的核心是建堆,传入参数为数组,根节点位置,数组长度 void Heap_build(int a[], in...
2018-07-31 14:56:42
1215
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人