Back to Browse

Queue in Data Structure Using C Programming Language

92 views
Jul 6, 2021
50:30

The queue is member of linear data structure and work as the rule of First In First out(FIFO). In other word we can say that two ends of the list their inserting and deleting element of list is possible. Thus, we can say that queue is restricting list. Queue is a very useful linear data structure. Many concepts use this algorithm to implement their process. Like time sharing systems, network management also uses operating system to maintain their functioning. A queue is a linear data structure in which addition new element at rear of the list and deletion at front of the list. Like line of persons for railway ticket reversions, queue of customers waiting to pay the electrical bill…etc. General linear data structure such as an array and linked list allows us to insert and delete an element at any place in the list, either at the beginning or at the end or even in the middle of the list, but in queue is restrict data structure. Thus we can addition and deletion element at two end places, not allows us to addition or deletion element at middle of the list. We are comparing queue with like one room has only two doors one for enter and second for exit to person. The queue is also called line list. Real life practical example of queue is as given below : 1. Line of persons for railway ticket reservation. 2. Queue of customers waiting to pay the electricity bill 3. Queue of passengers waiting for a bus. 4. Spectators waiting in a line to get tickets. 5. Students move their task to line of queue 6. Bullet in a machine gun. Definition : Queue means we can add new element at rear of the list and delete element at front of the list. In other word we can say that queue is a linear data structure that permits insertion of new element at one end and deletion of an element at the other end. There are only two ends of the lists : Rear : The end at which insertion of a new element can take place is called rear. Front : The end at which the deletion of an element take place is called front. The first element that gets added into the queue is the first one to get removed from the list. Hence, queue is also knows as First In First Out (FIFO) list. Operations on Queue : 1. Inserting : Added new element at the rear end of the list. 2. Deleting : Removed an element at the front of the list. 3. Searching : Find particular element into the list. 4. Display/show : Print all elements of the list. 5. Count : Total no. of elements into the list. Application of queue in computer science are as given below : 1. Time sharing systems for use of the CPU. 2. Waiting for the line printer. 3. For access to disk storage. 4. Solving any queuing theory definition 5. Wait one’s turn before having access to some process. 6. Used in computer networking 7. Used in operating system 8. Used In simulation There are two techniques to implement to queue as given below : 1. Implementation of queue using arrays 2. Implementation of queue using linked list Array implementation of queues : Array can be used to represent queue, it is very easily if we represent using array but problem is using array that we provide fixed size of array at beginning of array declaration, so care should be exercises that take size of array. We can give maximum size of array when declaration time of array and maintain two variables front and rear to initialize to -1 value. When front=-1 and rear=-1 means there is no data into queue.

Download

0 formats

No download links available.

Queue in Data Structure Using C Programming Language | NatokHD