a interface to stack that implement use the fixed array.
来源:互联网 发布:卖家怎样加入淘宝客 编辑:程序博客网 时间:2024/05/16 07:45
/* a interface to stack that implement use the fixed array.
date: 2006.11.23
author: dongshuiluo
complier: dec-c++ 4.9.9.2
*/
#ifndef DONGSHUILUO_STACK_H
#define DONGSHUILUO_STACK_H
typedef struct StackItem StackItem;
typedef struct Stack Stack;
struct StackItem /* user should modify it */
{
int a;
};
struct Stack
{
StackItem *items;
unsigned int top;
unsigned int capacity;
};
/* usage: initlize a stack use the size and before you use it .
pre: size >= 0
post: return a stack pointer, if fail then return NULL.
*/
extern Stack *CreatStack( unsigned int size );
/* usage: add a new element to a exist stack.
pre: the stack has been created and the stack not full.
post: return 0 if success otherwise -1.
*/
extern int push( StackItem item, Stack *stack );
/* usage: get the top element from a exist stack.
pre: the stack has been created and the stack is not empty.
post: the element's will be stored in *item,
and return 0 if success otherwise -1.
*/
extern int top( StackItem *item, Stack *stack );
/* useage: remove the top element from a exist stack.
pre: the stack has been created and the stack is not empty.
post: the top element will be removed,
and return 0 if success otherwise -1.
*/
extern int pop( Stack *stack );
/* usage: judge the exist stack is empty or not.
pre: the stack has been created.
post: return 1 if the stack is empty otherwise 0.
*/
extern int StackEmpty( Stack *stack );
/* usage: judge the exist stack is full or not.
pre: the stack has been created.
post: return 1 if the stack is full otherwise 0.
*/
extern int StackFull( Stack *stack );
/* usage: get the element's number of the stack.
pre: the stack has been created.
post: the stack's size as return value.
*/
extern unsigned int StackSize( Stack *stack );
/* usage: get the stack's capacity.
pre: the stack has been created.
ppst: the stack's capacity as a return value.
*/
int StackCapacity( Stack *stack );
/* usage: make the stack become to a empty stack.
pre: the stack has been created.
post: the stack is empty.
*/
extern int MakeEmpty( Stack *stack );
/* usage: depose a stack when you nerver use it again.
pre: the stack has been created.
post: you can not use the stack again.
*/
extern int DesposeStack( Stack *stack );
#endif
- a interface to stack that implement use the fixed array.
- Use Java reflection to find classes that implement an interface from a package
- 【14】Use a single array to implement three stacks
- Ch3-1: use a single array to implement three stacks.
- Implement a stack that pops out the mostfrequently added item. Stack supports 3 functions – push,
- CareerCup Implement a stack that pops out the most frequently added item
- Q3.1 Describe how you could use a single array to implement three stacks
- Vagrant is attempting to interface with the UI in a way that requires a TTY
- Use the Stack mehod and a temporary Stack to retrieve entries from the Stack source and add
- use stack to initial a treeview with the data in a database
- CC150 3.1 Three in one: describe how you could use a single array to implement 3 stacks.
- Use a Static Route to the Null0 Interface for routing Loop
- pointer to ref of an array, and to the func that return a ref of an array
- Implement a queue/stack
- Use List to implement the Video play list
- how to use a SQLite database in a standalone program with an HTML interface and VBScript as the programming language
- How To Use the GitLab User Interface To Manage Projects
- 053-5 You run the SQL Tuning Advisor (STA) to tune a SQL statement that is part of a fixed SQL plan
- 使用 IBM Rational Functional Tester: 了解和使用 TestObject.find 方法
- 一个全世界最珍贵的故事
- 枚举所有库和库中所有表
- ASP.NET 2.0数据教程之一: 创建一个数据访问层
- 冒泡排序
- a interface to stack that implement use the fixed array.
- 未来
- ASP.NET 2.0数据教程之二:创建一个业务逻辑层
- 10月27
- 关于管理的经典故事(员工激励)
- ASP.NET2.0教程之三:母板页和站点导航
- Format的用法
- 《输赢》一部可用于销售培训的精彩商战小说
- 随机数