
C/C++
zqm175899960
这个作者很懒,什么都没留下…
展开
-
全排列和组合的实现
#include "stdafx.h"#include #include #define MAX 100int nCount = 0;void Perm(char s[],int index[],int count,int currentCount);void Combination(char s[],int index[],int count,int currentCount,in原创 2012-09-09 23:08:09 · 757 阅读 · 0 评论 -
libevent使用ndk-r8d编译
使用的是android-ndk-r8d库,使用的libevent版本号为libevent-2.0.21-stable稳定版然后是调整宏参数在event2/event-config.h中添加如下宏定义#define _EVENT_HAVE_SA_FAMILY_T 1#define _EVENT_HAVE_SYS_SOCKET_H 1#define _EVENT_HAVE_NETINE原创 2014-01-15 20:43:49 · 3655 阅读 · 5 评论 -
二元树中找出和为某一值的所有路径
在二元树中找出和为某一值的所有路径题目:输入一个整数和一棵二元树。从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径。打印出和与输入整数相等的所有路径。例如 输入整数22和如下二元树 10 / \ 5 12 / \ 4 7则打印出两条路径:10, 12和10, 5, 7。// MatrixMaxValue.cpp : Defin原创 2012-09-18 11:20:27 · 807 阅读 · 0 评论 -
反转链表(递归和非递归实现)
// ReverseLink.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include struct Node { int data; Node* next;};void CreateLink(Node* &head,int data);原创 2012-09-19 10:21:56 · 397 阅读 · 0 评论 -
螺旋打印(由内向外旋)
// SpinPrint.cpp : Defines the entry point for the console application.////螺旋打印#include "stdafx.h"#include #include #include int** getCreateMatrix(int nVectors);void SpinnerPrint(int** Matrix原创 2012-09-19 00:59:10 · 947 阅读 · 0 评论 -
把二元查找树转变成排序的双向链表
把二元查找树转变成排序的双向链表题目:输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。要求不能创建任何新的结点,只调整指针的指向。 10 / / 6 14/ / / /4 8 12 16 转换成双向链表4=6=8=10=12=14=16。#include using namespace std;class Node{public:原创 2012-09-18 00:12:33 · 602 阅读 · 0 评论 -
螺旋打印数组
// SpinPrint.cpp : Defines the entry point for the console application.////螺旋打印#include "stdafx.h"#include #include #include int** getCreateMatrix(int nVectors);void SpinnerPrint(int** Matrix原创 2012-09-18 22:48:17 · 483 阅读 · 0 评论 -
求一颗二叉树中叶子节点间最大的路径长度
int LongestPath(BitTree* node, int curIndex){ int m,n; if(!node) return 0; m = LongestPath(node->lChild,curIndex+1); n = LongestPath(node->rChild,curIndex+1); if(curIndex == 0) return (m+n);原创 2012-09-16 13:13:48 · 1474 阅读 · 0 评论 -
人人笔试1:一个人上台阶可以一次上1个,2个,或者3个,问这个人上n层的台阶,总共有几种走法?
#include #define MAXSIZE 200int Stack[MAXSIZE];int Step[] = {1,2,3};void UpStairs(int TotalSteps,int Step[],int size);int main(){ UpStairs(10,Step,sizeof(Step)/sizeof(Step[0])); return 0;原创 2012-09-15 21:46:25 · 2674 阅读 · 1 评论 -
自己实现的非递归组合
#include #include #define MAXSIZE 100#define INVALID -1int Stack[MAXSIZE];void Combination(const char ch[],int nSize,int path);int main(int argc, char* argv[]){ int i = 0; int len = 0; co原创 2012-09-12 00:10:01 · 553 阅读 · 0 评论 -
自己写的非递归背包问题
#include #define N 10#define W 34int Index[N] = {0};int Stack[N] = {0};int MaxWeight = 0;int main(int argc, char* argv[]){ int weight[] = {3,2,4,5,7,8,2,4,3,2}; int Valid = -1; int top =原创 2012-09-11 22:18:49 · 366 阅读 · 0 评论 -
全排列的非递归实现
#include #include #define MAXSIZE 100#define INVALID -1int Stack[MAXSIZE];int main(int argc, char* argv[]){ int i = 0; int j = 0; int len = 0; int curIndex = 0; int findit = 0; int begi原创 2012-09-11 23:37:18 · 605 阅读 · 0 评论 -
自己实现的递归背包算法
#include #define N 10#define W 19int Index[N] = {0};int Stack[N] = {0};int MaxWeight = 0;int CurrentWeight = 0;int BeiBao(int weights[],int Stack[],int nStart,int nSize,int nCount,int TotalW原创 2012-09-11 21:40:44 · 411 阅读 · 0 评论 -
二叉树C++实现
//============================================================================// Name : TreeNodeCPP.cpp// Author : zhouqinmin// Version :// Copyright : baidu// Description : Hel原创 2015-05-15 15:11:04 · 377 阅读 · 0 评论