![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
Supermanlyy
这个作者很懒,什么都没留下…
展开
-
一组关于日期计算的代码
DateTime.h#ifndef _DATE_TIME_H_#define _DATE_TIME_H_#ifdef __cplusplusextern "C" {#endif#define YES 1#define NO 0 typedef struct _DateTime{ unsigned short wSecond; /* The current se原创 2013-01-10 15:16:30 · 813 阅读 · 0 评论 -
包含min函数的栈
定义栈的数据结构,要求添加一个min函数,能够得到栈的最小元素。要求函数min、push以及pop的时间复杂度都是O(1)。#ifndef _CSTACK_WITH_MIN_#define _CSTACK_WITH_MIN_#define MAX_STACKSIZE 10template class CStackWithMin{public: CStackWithMin(原创 2013-04-12 10:51:26 · 543 阅读 · 0 评论 -
二叉树基本操作递归和非递归方法
#ifndef _BSTREE_H_#define _BSTREE_H_#include #include #include using namespace std;//二叉树节点类型定义templateclass BSTreeNode{public: BSTreeNode(const T& data, BSTreeNode* pLeft = NULL, BSTreeNod原创 2015-12-24 11:50:03 · 541 阅读 · 0 评论 -
将二叉树按中序遍历转换成双向链表
#include "BSTree.h"//将二叉树按中序遍历转换成双向链表(只调整指针的指向)templateBSTreeNode* BSTree2DoubleList(BSTreeNode* pRoot){ BSTreeNode* pNode = pRoot; BSTreeNode* pHeadNode = NULL; BSTreeNode* pPrevNode = NULL;原创 2015-12-24 12:41:43 · 1272 阅读 · 0 评论 -
求子数组的最大和
#include using namespace std;//////////////////////////////////////////////////////////////////////////// 题目:输入一个整形数组,数组里有正数也有负数。// 数组中连续的一个或多个整数组成一个子数组,每个子数组都有一个和。// 求所有子数组的和的最大值。要求时间复杂度为O(n)。原创 2015-12-24 14:53:02 · 408 阅读 · 0 评论