没有合适的资源?快使用搜索试试~ 我知道了~
C#编写一个类实现队列的功能,
5星 · 超过95%的资源 需积分: 20 49 下载量 134 浏览量
2009-12-18
22:39:18
上传
评论 1
收藏 38KB DOC 举报
温馨提示
试读
3页
C#编写一个类实现队列的功能,并编写一个测试类测试该队列的功能(参考.Net的类库中已经封装好了的队列类:System.Collections.Queue,可以将自己做好的类,和它进行比较)
资源推荐
资源详情
资源评论
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QueueWithCSharp
{
//定义节点类
public class Node
{
public int data; //节点的值
public Node prior, next; //前序节点,后续节点
public Node() //构造函数
{
prior = null;
next = null;
data = 0;
}
}
//定义队列类
public class Queue
{
Node head, rear; //头结点,尾节点
int length; //队列长度
public int Length //Length属性,只读
{
get
{ return length;
}
}
public Queue() //构造函数
{
head = rear = null;
length = 0;
}
public void EnQueue(int data) //给队列添加节点
{
if (rear == null)
{
rear = new Node();
head = rear;
rear.data = data;
资源评论
- 折夜2014-12-29还好,不过自己又写了一个
yuanwenjie123
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功