CBSE Class 12 Computer Science Question 45 of 63

Data Structures in Python — Question 19

Back to all questions
19
Question

Question 18(ii)

Write an algorithm to insert element into Queue as a list.

Answer

An algorithm to insert element into Queue as a list is as follows:

  1. START
  2. Queue = list() or Queue = [] #Initialize a Queue using list
  3. element = input("Enter the element to be added to the Queue: ")
  4. Queue.append(element) #Adding element into the list Queue
  5. STOP