队列排序,先进先出

此页面是否是列表页或首页?未找到合适正文内容。

队列排序,先进先出

标签:publicdivstr列排序staticrgsheadstringfor

/**
* 队列是一种特殊的线性结构,它只允许在队列的首部(head)进行删除操作,这称为“出队”,而在队列
* 的尾部(tail)进行插入操作,这称为“入队”。当队列中没有元素时(即head==tail),称为 空队列,
* “先进先出”(FirstIn First Out,FIFO)原则
*/
public static void main(String[] args)
{
int aa[] = new int[100];

int a[] = {0, 6, 3, 1, 7, 5, 8, 9, 2, 4}, head = 1, tail = 10;

for (int b = 0; b < a.length; b++)
{
aa[b] = a[b];
}

while (head < tail)
{
System.out.print(aa[head] + \” \”);
head++;
aa[tail] = aa[head];
tail++;
head++;
}
}

先将代码贴出来,记录一下小案例

队列排序,先进先出

标签:publicdivstr列排序staticrgsheadstringfor

原文地址:http://www.cnblogs.com/dayu007/p/7657275.html

作者: liuzhihao

为您推荐

返回顶部