
数据结构
彧圆
一个计算机专业小菜鸡
展开
-
数据结构--栈的构造模板
lk_stack.h:#pragma once#include "node.h" // 链栈类模板template<class ElemType>class LinkStack{protected: // 数据成员: Node<ElemType>* top; // 栈顶指针 int count; // 元素个数 public: // 抽象数据类型方法声明及重载编译系统默认方法声明: LinkStack.原创 2021-11-28 21:57:44 · 605 阅读 · 0 评论 -
数据结构--链队列的构造模板
lk_ queue.h#pragma once#include "node.h" // 链队列类模板 template<class ElemType>class LinkQueue{protected: // 数据成员: Node<ElemType>* front, * rear; // 队头队尾指针 int count; // 元素个数 public: // 抽象数据类型方法声明及重载编译系统默认方法声.原创 2021-11-28 21:55:54 · 202 阅读 · 0 评论 -
数据结构--求子节点的个数
基于上一篇我发的二叉树模板函数,添加一个子节点个数的函数, int SonCountHelp(const BinTreeNode<ElemType>* r) const;//子节点的个数 int SonCount() const;数据结构--二叉树构造模板_m0_53252742的博客-优快云博客inline int BinaryTree<ElemType>::SonCount() const{ return SonCountHelp(roo...原创 2021-11-27 00:56:51 · 531 阅读 · 0 评论 -
数据结构--二叉树构造模板
包含四个头文件,需要哪个函数直接抄上就可以的头文件:binary_tree:#pragma once#pragma once#include<iostream>#include"lk_ queue.h"#include"lk_stack.h"#include"node.h"using namespace std;template <class ElemType>struct BinTreeNode{ // 数据成员: ElemType data; .原创 2021-11-27 00:53:37 · 3941 阅读 · 0 评论 -
数据结构--栈(只包括常用的)
头文件:#pragma oncetemplate<class T,int MaxSize>class Seqstack{ T date[MaxSize]; int top;public: Seqstack(); void Push(T x); T pop(); T Top(); bool Empty(); void Clear();};cpp:文件#include "pch.h"#include "Seqstack.h"template <原创 2021-11-23 13:00:30 · 569 阅读 · 0 评论 -
数据结构--单链表模板的备份
#include<iostream>using namespace std;template <class ElemType>void Show(const ElemType &e)// 操作结果: 显示数据元素{ cout << e << " ";}// 结点类模板template <class ElemType>struct Node{ // 数据成员: ElemType data; // 数据.原创 2021-11-22 21:07:01 · 557 阅读 · 0 评论 -
数据结构--备份一下顺序表的函数模板和对应函数
#include<iostream>using namespace std;#define DEFAULT_SIZE 1000 // 缺省元素个数template <class ElemType>void Show(const ElemType &e)// 操作结果: 显示数据元素{ cout << e << " ";}// 顺序表类模板template <class ElemType>class S.原创 2021-11-22 21:03:48 · 497 阅读 · 0 评论