
Data Structure
文章平均质量分 77
Southan97
本科计算机科学与技术专业,现软件工程专业在读研究生
展开
-
数据结构之顺序表——C++模板类实现
数据结构之顺序表——C++模板类实现#ifndef LINEARLIST_H_INCLUDED#define LINEARLIST_H_INCLUDED#include using namespace std;templateclass LinearList {public: LinearList() {cout << "Constructing a LinearList in defaul原创 2017-03-05 19:40:00 · 653 阅读 · 0 评论 -
数据结构之单链表——C++模板类实现
数据结构之单链表——C++模板类实现原创 2017-03-05 19:42:30 · 968 阅读 · 0 评论 -
数据结构之循环队列(顺序表存储)——C++模板类实现
基于数组存储形式的循环队列实现 循环队列的基于数组的存储表示亦称为顺序队列,用一个一维数组elem[maxSize]来实现,其中为了区别队列空与满,该数组中最多存储maxSize-1个元素,如此一来,判断循环队列满的条件便是:(_rear + 1) % maxSize == _rear而判断循环队列空的条件则是:_rear == _front 之所以要取模maxSize是为了节原创 2017-03-11 14:00:00 · 1029 阅读 · 0 评论 -
数据结构之栈(链式存储)——C++模板类实现
栈的链式存储结构之C++实现链式栈是线性表的链接存储表示,采用链式栈来表示一个栈,便于结点的插入与删除。在程序中同时使用多个栈的情况下,用链式表示不仅能提高效率,还可以达到共享存储空间的目的。#ifndef STACK_H_INCLUDED#define STACK_H_INCLUDED#include const int maxSize = 284;templateclass原创 2017-03-11 13:08:01 · 723 阅读 · 0 评论 -
给定先序和后续,构造出一颗二叉树并输出中序序列
给定先序和后续,构造出一颗二叉树并输出中序序列Algorithm: buildTree()1) Pick an element from Preorder. Increment a Preorder Index Variable (preIndex in below code) to pick next element in next recursive call.2) Create a new tree node tNode with the data as picked element.3) F原创 2017-05-17 23:44:09 · 620 阅读 · 0 评论 -
Binary Tree K level sum (samsung)
Given a binary tree and a number K, the task is to find sum of tree nodes at level k. The Binary Tree s given in string form: (node-value(left-subtree)(right-subtree)).Input:The first line of in原创 2017-05-18 02:04:03 · 392 阅读 · 0 评论