数据结构
你看,那是海边
优秀是一种习惯!
展开
-
C++模板实现单链表基本操作
#ifndef LINKLIST_H #define LINKLIST_H #include <iostream> using namespace std; template <typename T> struct Node{ T data; struct Node* next; }; template <typename T> class...原创 2019-05-21 20:45:13 · 992 阅读 · 0 评论 -
广度优先搜寻与深度优先搜寻代码模板
1.广度优先搜寻 #include <iostream> #include <queue> using namespace std; #define MAXROW 10 #define MAXLINE 10 typedef struct _Point { int _x; int _y; }Point; Point prePonit[MAXROW][MAX...原创 2019-05-21 20:54:42 · 229 阅读 · 0 评论 -
C++模板实现二叉树基本操作
#ifndef BINARYTREE_H #define BINARYTREE_H #include <iostream> #include <stack> #include <queue> using namespace std; template <typename T> struct btNode { T _data; s...原创 2019-05-16 21:29:14 · 951 阅读 · 0 评论 -
C++类模板实现双链表基本操作
#include <iostream> using namespace std; template<typename T> struct DuLNode { T val; DuLNode* prior; DuLNode* next; }; template<typename T> class DuList { public: DuList(); ...原创 2019-06-15 10:57:35 · 594 阅读 · 0 评论 -
C语言实现循环队列的头部插入、尾部插入、头部出队、尾部出队
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> typedef struct _queue { int *buffer; unsigned int front; unsigned int rear; unsigned int size; }queue; ...原创 2019-09-04 14:15:30 · 2685 阅读 · 0 评论 -
C++实现迪杰斯特拉算法
#include <iostream> #include <vector> #include <limits> using namespace std; typedef struct _MGraph { int vertex_num; vector<vector<int>> arcs; }MGraph; void Dijkst...原创 2019-09-05 17:15:04 · 1334 阅读 · 1 评论 -
C++实现基于数组+链表的简易版HashMap
1.HashMap原理示意图 2.C++代码实现 #include <iostream> using namespace std; typedef struct HashNode { int val; struct HashNode* next; }HashNode; class hash_map { public: hash_map(); hash_map(c...原创 2019-09-27 16:36:33 · 629 阅读 · 1 评论