} /* Q has only one element, so we reset the queue after deleting it. Print("After removing an element from the queue") Write the code to display all elements of queue named 'Aqueue'. Which method of list is used to add element at the end Q4. In queue, addition and deletion of elements take place at different ends(T/F) Q3. # Your M圜ircularQueue object will be instantiated and called as such: What is the difference between Stack and Queue data structure in python Q2. Print("No element in the circular queue")įor i in range(self.head, self.tail + 1): En-queue and De-queue are terms for operations used to add or delete items from a queue. Operations on a queue can be performed from both ends, head and tail. The data which is entered first will be accessed first. # Delete an element from the circular queue Queue: Queue is a linear data structure which is based on the First in First out principle (FIFO). If ((self.tail + 1) % self.k = self.head): # Insert an element into the circular queue # Circular Queue implementation in Python
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |