Follow

Translate

Wednesday, March 16, 2016

QINSERT(QUEUE, N, FRONT, REAR, ITEM)


1.    [Queue already filled?]
          If FRONT = 1 and REAR = N, or if FRONT = REAR + 1, then:
              Write: OVERFLOW, and Return.

2.             [Find new value of REAR.]

                       If  FRONT : = NULL, then : [Queue initially empty.]
                          Set FRONT : = 1 and REAR : = 1

Else :
              Set REAR : = REAR + 1 .

[End of  If structure]

3.  Set QUEUE[REAR] : = ITEM.     [This inserts new element]

4. Return
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

0 comments:

Post a Comment