data structures and application 5.3.2完整版 ( 栈的实现 )

本文详细探讨了数据结构中栈的概念,并重点介绍了如何实现栈,内容涵盖栈的基本操作及其在实际问题中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


此篇文章仅供个人学习记录之用,题目是Data Structures, Algorithms, and Applications in C++中 5.3.2中的例题进行扩展的练习题目,代码如下:

#ifndef HEADER_1_H_
#define HEADER_1_H_
//#include <cstdlib>

template <class T>
class Stack{
public:
	Stack( T& x );		//构造函数
	~Stack() { delete [] stack; }		//析构函数
	//void s_stack() { delete [] stack; }		//仿析构函数,后来发现其实析构函数和这个函数是一
//样的。。
	bool IsEmpty() const { return top == -1; }	
	bool IsFull() const { return top == MaxTop; }
	
	T Top() const;
	
	Stack <
Data Structures, Algorithms and Applications in C++ Second Edition Sartraj Sahni | Universities Press 2005 | ISBN: 817371522X | PDF | 826 Pages | 27 MB Description The study of data structures and algorithms is fundamental to computer science and engineering. A mastery of these areas is essential for us to develop computer programs that utilize computer resources in an effective manner. This book is a nice description of data structures in C++. The Part I of book consist of c++ review and preliminaries, Part II consists of data structures including Lists, Dictionaries, Stacks, Queues and trees and their different types of representations, Arrays and Matrices, Graphs and Performance analysis and Part III consists of Algorithm-Design Methods including Greedy method, Divide and conquer, Dynamic Programming, Backtracking (on the web), Branch and Bound (on the web). Table of Contents Part I Preliminaries Chapter 1 C++ Review Chapter 2 Performance Analysis Chapter 3 Asymptotic Notation Chapter 4 Performance Measurement Part II Data Structures Chapter 5 Linear Lists - Arrays Representation Chapter 6 Linear Lists - Linked Representation Chapter 7 Arrays and Matrices Chapter 8 Stacks Chapter 9 Queues Chapter 10 Skip Lists and Hashing Chapter 11 Binary and Other Trees Chapter 12 Priority Queues Chapter 13 Tournament Trees Chapter 14 Binary Search Trees Chapter 15 Balanced Search Trees Chapter 16 Graphs Part III Algorithm Design Methods Chapter 17 The Greedy Method Chapter 18 Divide and Conquer Chapter 19 Dynamic Programming Chapter 20 Backtracking (On the Web) Chapter 21 Branch and Bound (On the Web) Index
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值