欢迎来到我的博客https://www.cnblogs.com/veis/

https://www.cnblogs.com/veis/p/14182037.html

随笔分类 -  C/C++数据结构

C/C++数据结构
摘要:1、源代码 #include "list.h" // 1、创建头结点 Node * CreateHeadeNode(void) { Node *pHead = (Node *)malloc(sizeof(Node)); pHead->m_pNext = NULL; return pHead; } / 阅读全文
posted @ 2020-05-18 21:49 veis 阅读(196) 评论(0) 推荐(0)
摘要:1、源代码 #include "queue.h" /** * [CreateQueue 创建一个队列] * @param nCount [队列的长度] * @return [队列指针] */ p_queue CreateQueue(uint32_t nCount) { p_queue p = mal 阅读全文
posted @ 2020-05-18 21:26 veis 阅读(483) 评论(0) 推荐(0)
摘要:1.源代码 #include "stack.h" /** * [CreateStack 创建一个栈结构] * @param p [要创建的栈类型指针] * @param nSize [栈大小] */ p_stack CreateStack(int nSize) { p_stack ps = mall 阅读全文
posted @ 2020-05-18 18:37 veis 阅读(355) 评论(0) 推荐(0)
摘要:#pragma once template<typename KEY, typename VALUE, typename ARG_KEY = KEY&, typename ARG_VALUE = VALUE&> class CMap { struct SNode { KEY key; VALUE v 阅读全文
posted @ 2020-03-27 18:11 veis 阅读(180) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <stdbool.h> 4 5 typedef int DATA; 6 typedef struct _SNode_ 7 { 8 DATA data; 9 struct _SNode_ *p_ 阅读全文
posted @ 2020-03-27 09:44 veis 阅读(322) 评论(0) 推荐(0)
摘要:/* STL map类的使用示例 功能:常用增删改查函数测试 */ #include <map> #include <string> #include <iostream> using namespace std; int main() { // 无参构造对象 map<char, string> m 阅读全文
posted @ 2020-03-22 22:10 veis 阅读(134) 评论(0) 推荐(0)
摘要:#pragma once template<typename KEY, typename VALUE, typename ARG_KEY = KEY&, typename ARG_VALUE = VALUE&> class CMap { struct SNode { KEY key; VALUE v 阅读全文
posted @ 2020-03-21 16:42 veis 阅读(236) 评论(0) 推荐(0)
摘要:#pragma once template<typename TYPE, typename ARG_TYPE=const TYPE&> class CArray { TYPE *m_pData; int m_nCount; int m_nSize; public: TYPE & GetAt(int 阅读全文
posted @ 2020-03-17 23:03 veis 阅读(419) 评论(0) 推荐(0)
摘要:1 #pragma once 2 // C++环形队列类模板 3 typedef unsigned int uint32_t; // 使用可移植数据类型 4 template<typename DATA> 5 class CQueue 6 { 7 DATA *m_pData; 8 uint32_t 阅读全文
posted @ 2020-03-17 00:11 veis 阅读(408) 评论(0) 推荐(0)
摘要:1 #pragma once 2 3 template <typename DATA> 4 class CStack 5 { 6 DATA *m_pData; 7 int m_nCount; 8 int m_nTop; // 栈顶位置 9 public: 10 CStack(int nCount = 阅读全文
posted @ 2020-03-16 21:00 veis 阅读(308) 评论(0) 推荐(0)