Lecture Algorithms and data structures (CSC112) - Chapter 25

Chapter 25 - Types of Queue. This chapter provided a broad presentation about the database development process. You learned about the relationship between database development and information systems development, the phases of database development, and the kinds of skills you need to master. This chapter presents the notation of entity relationship diagrams to provide a foundation for using entity relationship diagrams in the database development process. | Queue 1 Queue Operations on Queues A Dequeue Operation An Enqueue Operation Array Implementation Link list Implementation Examples Queue It is a linear data structure used to represent a linear list and permits deletion to be performed at one end and of the list and the insertions at the other end. The information in such a list is processed in the same order as it was received. basis(FCFS). Or FIRST IN FIRST OUT(FIFO). 2 Queue items[MAXQUEUE-1] . . . . . . items[2] C items[1] B items[0] A Front=0 Rear=2 3 3 Declaration of a Queue # define MAXQUEUE 50 /* size of the queue items*/ typedef struct { int front; int rear; int items[MAXQUEUE]; }QUEUE; 4 4 Implementation of queue. Two common ways in which queues may be implemented are as follows: ARRAYS POINTERS(one way linear linked list) 5 Operations of queue Insertion in queue. Deletion in queue. List(display) of the queue. 6 Different type of queue Circular queue Double Ended Queue Priority queue 7 Circular queue Let we have an array named Q, that contains n element in which Q[1] comes after Q[n] in the array. When this technique is used to construct a queue is called circular queue. In other word we can say that a queue is called circular when the last room comes just before the first room. 8 Circular queue . Q[1] Q[2] Q[3] . . . Q[n-1] Q[n] 9 Queue cont . In a circular queue when rear=n, if we insert an element then this element is assigned to q[1] instead of increasing rear to n+1. Suppose queue contains only one element that is front=rear!=0 and suppose that the element is removed then the front and rear pointers are now assigned ‘0’ to indicate that the queue is EMPTY. 10 Application of queue An . of queue is time sharing computer system where many users share the system simultaneously. The procedure, which is used to design such type of system, is Round Robin Technique. The railway reservation counter is also an example of queue where the people collect their tickets on FIFO or FCFS | Queue 1 Queue Operations on Queues A Dequeue Operation An Enqueue Operation Array Implementation Link list Implementation Examples Queue It is a linear data structure used to represent a linear list and permits deletion to be performed at one end and of the list and the insertions at the other end. The information in such a list is processed in the same order as it was received. basis(FCFS). Or FIRST IN FIRST OUT(FIFO). 2 Queue items[MAXQUEUE-1] . . . . . . items[2] C items[1] B items[0] A Front=0 Rear=2 3 3 Declaration of a Queue # define MAXQUEUE 50 /* size of the queue items*/ typedef struct { int front; int rear; int items[MAXQUEUE]; }QUEUE; 4 4 Implementation of queue. Two common ways in which queues may be implemented are as follows: ARRAYS POINTERS(one way linear linked list) 5 Operations of queue Insertion in queue. Deletion in queue. List(display) of the queue. 6 Different type of queue Circular queue Double Ended Queue Priority queue 7 Circular .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.