양방향 순환 대기열 분석
양방향 순환 대기열은 순환 대기열의 기초 위에서
public class Deque {   
    private int maxSize;   
    private int left;   
    private int right;   
    private int nItems;   
    private long[] myDeque;   
    //constructor   
    public Deque(int maxSize){   
        this.maxSize = maxSize;   
        this.myDeque = new long[this.maxSize];   
        this.nItems = 0;   
        this.left = this.maxSize;   
        this.right = -1;   
    }   
    //insert a number into left side   
    public void insertLeft(long n){   
        if(this.left==0) this.left = this.maxSize;   
        this.myDeque[--this.left] = n;   
        this.nItems++;   
    }   
    //insert a number into right side   
    public void insertRight(long n){   
        if(this.right==this.maxSize-1) this.right = -1;   
        this.myDeque[++this.right] = n;   
        this.nItems++;   
    }   
    //remove from left   
    public long removeLeft(){   
        long temp = this.myDeque[this.left++];   
        if(this.left==this.maxSize) this.left = 0;   
        this.nItems--;   
        return temp;   
    }   
    //remove from right   
    public long removeRight(){   
        long temp = this.myDeque[this.right--];   
        if(this.left==-1) this.left = this.maxSize-1;   
        this.nItems--;   
        return temp;   
    }   
    //return true if deQue is empty   
    public boolean isEmpty(){   
        return (this.nItems==0);   
    }   
    //return size of the deQue   
    public int size(){   
        return this.nItems;   
    }   
}  
                이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
pandas 읽기 및 쓰기 Excelpandas 읽기와 쓰기 Excel은 중복된 데이터 가공 작업을 pandas에 맡기고 수동 노동을 절약하며 사용하기도 편리하지만 출력의 형식은 그다지 아름답지 않다.본고는 read_excel()과to_excel()의...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.