上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要: /*堆排序数组实现*/#include #include #define N 8#define M N+1/*队列*/ int rear=N,front=(N+1)/2;//此处有N+1个已入队 void change(int *a,int *b){ int t... 阅读全文
posted @ 2015-03-12 22:09 机智的程序员小熊 阅读(183) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class Base{ protected: Base *next; public: Base(Base *t){ next... 阅读全文
posted @ 2015-03-08 23:17 机智的程序员小熊 阅读(174) 评论(0) 推荐(0) 编辑
摘要: GCC编译通过:#include #include #define N 10#define MAX 100typedef struct node{ int data; struct node *left; struct node *right;}BT... 阅读全文
posted @ 2015-03-08 23:15 机智的程序员小熊 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 按层建树是按照给定的数据数组来建立完全二叉树的过程。其中涉及到的基础知识有结构体的创建重命名以及使用、链表的创建和数组遍历。 实现代码如下: GCC编译通过:#include #include #define N 10#define MAX 100typedef ... 阅读全文
posted @ 2015-03-08 23:14 机智的程序员小熊 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 函数专题(简介)一、 引入在数学中有表示关系函数“f(x)”,“f(x)”中的“x”是自变量“f(x)”的值是因变量. 例1:f(x)=x+Y;二、 概述在C语言中,“f(x)”同样表示关系函数,x就是传入的值,若x=1,那么在例1中f(x)=f(1)=1... 阅读全文
posted @ 2015-02-05 23:10 机智的程序员小熊 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 区间K大数问题描述给定一个序列,每次询问序列中第l个数到第r个数中第K大的数是哪个。输入格式第一行包含一个数n,表示序列长度。第二行包含n个正整数,表示给定的序列。第三个包含一个正整数m,表示询问个数。接下来m行,每行三个数l,r,K,表示询问序列从左往右第l个数到第... 阅读全文
posted @ 2015-02-04 18:32 机智的程序员小熊 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 今天在做蓝桥杯题目的时候看到一题十六进制转八进制的题目,题目如下:问题描述 给定n个十六进制正整数,输出它们对应的八进制数。输入格式 输入的第一行为一个正整数n (1#include #include #define N 100001char str[N];vo... 阅读全文
posted @ 2015-01-24 14:53 机智的程序员小熊 阅读(123) 评论(0) 推荐(0) 编辑
摘要: /* Theme:八皇后(非递归) Coder:秒针的声音 Time:2015.1.13 */ #include using namespace std; #include #include int No=0; void Prin(int *q,int ... 阅读全文
posted @ 2015-01-13 23:14 机智的程序员小熊 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 近期学习了回溯算法于是自己写了马踏棋盘的递归以及非递归方式的代码:/* Theme:马踏棋盘 回溯算法 Coder:秒针的声音 Time:2015.1.11 */#include #include #include #define M 8... 阅读全文
posted @ 2015-01-13 01:45 机智的程序员小熊 阅读(478) 评论(0) 推荐(0) 编辑
摘要: 回溯算法的基本框架为 函数名(int cnt){ for() { 赋值; if(==){ }else{ 函数名(cnt+1); ... 阅读全文
posted @ 2015-01-11 20:14 机智的程序员小熊 阅读(261) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 下一页