ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 원형 큐 알고리즘
    공부/알고리즘 2024. 6. 15. 15:00
    728x90

    pseudocode

    원형 큐 생성 : font, rear 0으로 초기화
    createQUeue()
        cQ[n];
        front<-0;
        rear<-0;
    
    공백상태 검사
    isEmpty(cQ)
        if (front == rear) then return true;
        else return false;
    end isEmpty()
    
    포화상태 검사
    isFull(cQ)
        if(((rear+1)mod n)==front) then return true;
        else return false;
    end isFull()
    
    원형 큐 삽입
    enQueue(cQ, item)
        if (isFull(cQ)) then Queue_Full();
        else {
            rear <-(rear+1) mod n;
            cQ[rear]<item;
            }
        end enQueue()
    
    원형큐삭제
    deQueue(cQ)
        if(isEmpty(cQ)) then Queue_Empty();
        else {
            front<-(front+1) mod n;
            return cQ[front];
        }
        end deQueue()

    '공부 > 알고리즘' 카테고리의 다른 글

    알고리즘 정리  (0) 2023.10.09
    KMP, 라빈 카프 알고리즘  (0) 2021.06.15
    DFS/BFS  (0) 2021.05.29
    구현  (0) 2021.05.29
    그리디 알고리즘  (0) 2021.05.29

    댓글

Designed by Tistory.