数据结构_C++
Tom Boom
这个作者很懒,什么都没留下…
展开
-
二叉树C++ | 链表递归实现二叉树(插入、搜索)_1
递归实现二叉树(插入、搜索)// Binary Search Tree - Implemenation in C++// Simple program to create a BST of integers and search an element in it #include<iostream>using namespace std;//Definition of N...原创 2018-12-19 13:32:06 · 947 阅读 · 0 评论 -
链表C++ | 根据 位置 / 值 删除节点_2
根据 位置 删除节点#include<iostream>struct ListNode{ int m_nValue; ListNode* m_pNext;};ListNode* AddToTail(ListNode** pHead, int Value){ ListNode* pNew = new ListNode(); pNew-&g...原创 2018-12-25 12:33:17 · 453 阅读 · 0 评论 -
二叉树C++ | 查找节点(中序搜索)_5
查找节点(中序搜索) /* C++ program to find Inorder successor in a BST */#include<iostream>using namespace std;struct Node { int data; struct Node *left; struct Node *right;};//Function to fin...原创 2018-12-21 19:48:25 · 1239 阅读 · 1 评论 -
二叉树C++ | 实现删除节点_4
删除节点/* Deleting a node from Binary search tree */#include<iostream>using namespace std;struct Node { int data; struct Node *left; struct Node *right;};//Function to find minimum in a...原创 2018-12-21 17:19:45 · 3251 阅读 · 3 评论 -
队列C++ | 用数组实现队列_1
用数组实现队列/* Queue - Circular Array implementation in C++*/#include<iostream>using namespace std; #define MAX_SIZE 101 //maximum size of the array that will store Queue. // Creating a clas...原创 2018-12-16 20:33:14 · 489 阅读 · 0 评论 -
链表C++ | 从尾部打印头部(使用栈、递归实现)_3
从尾部打印头部栈 - 实现:void printListReversingly_Iteratively(ListNode** pHead){ std::stack<ListNode*> nodes; ListNode* pNode = *pHead; while(pNode!=nullptr){ nodes.push(pNo...原创 2019-01-10 12:39:43 · 217 阅读 · 0 评论 -
链表C++ | 实现头部、尾部插入数据_1
头部插入#include<iostream>struct ListNode{ int m_nValue; ListNode* m_pNext;};void AddToTop(ListNode** pHead, int Value){ ListNode* pNew = new ListNode(); pNew->m_nValue =...原创 2018-12-21 22:02:02 · 2548 阅读 · 0 评论 -
二叉树C++ | 深度优先遍历(前序、中序、后序)_3
深度优先遍历/* Binary Tree Traversal - Preorder, Inorder, Postorder */#include<iostream>using namespace std; struct Node { char data; struct Node *left; struct Node *right;};//Function to...原创 2018-12-20 14:32:06 · 328 阅读 · 0 评论 -
二叉树C++ | 广度优先遍历(层级顺序遍历)_2
层级顺序遍历二叉树 /* Binary tree - Level Order Traversal */#include<iostream>#include<queue>using namespace std;struct Node { char data; Node *left; Node *right;};// Function to prin...原创 2018-12-20 12:05:00 · 495 阅读 · 0 评论 -
队列C++ | 用链表实现队列_2
用链表实现队列/*Queue - Linked List implementation*/#include<stdio.h>#include<stdlib.h>struct Node { int data; struct Node* next;};// Two glboal variables to store address of front and...原创 2018-12-17 16:03:36 · 764 阅读 · 0 评论