心如止水
Je n'ai pas le temps
posts - 400,comments - 130,trackbacks - 0
以下是我的代码:
const long maxn=1007;
typedef 
struct
{
    
long front,rear,count,item[maxn];
}queue;
void clear(queue &q)
{
    q.count
=0;
    q.front
=0;
    q.rear
=-1;
}
bool empty(queue &q)
{
    
return (q.count==0);
}
void put(queue &q,long x)
{
    q.rear
++;
    q.item[q.rear]
=x;
    q.count
++;
}
void get(queue &q,long &x)
{
    x
=q.item[q.front];
    q.front
++;
    q.count
--;
}


posted on 2010-01-21 22:44 lee1r 阅读(336) 评论(0)  编辑 收藏 引用 所属分类: 算法与数据结构

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理