Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Queue in the C file #1801

Closed
Muskan1009 opened this issue Dec 6, 2023 · 2 comments
Closed

Add Queue in the C file #1801

Muskan1009 opened this issue Dec 6, 2023 · 2 comments

Comments

@Muskan1009
Copy link

A queue is a fundamental data structure in computer science that follows the First-In-First-Out (FIFO) principle. It represents a collection of elements where the first element added is the first one to be removed. Queues are commonly used in various applications, such as task scheduling, breadth-first search algorithms, and handling data in a sequential manner.

Steps:

  • Create a structure to represent a node in the queue.
    
  • Each node contains data and a pointer to the next node.
    
  • Create a structure to represent the queue.
    
  • The queue structure contains pointers to the front and rear nodes.
    
  • Create a function to initialize an empty queue.
    
  • Set both front and rear pointers to NULL.
    
  • Create a function to check if the queue is empty.
    
  • Return 1 if the front pointer is NULL, indicating an empty queue.
    
  • Create a function to add an element to the rear of the queue.
    
  • Create a new node, set its data, and update the pointers accordingly.
    
  • Create a function to remove the front element from the queue.
    
  • Update the front pointer and free the memory of the dequeued node.
    
  • Create a function to display the elements in the queue.
    
  • In the main function, initialize a queue, enqueue elements, dequeue elements, and display the queue.
    
@Muskan1009
Copy link
Author

can u assign me this issue under swoc ? @Kumar-laxmi

Copy link

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant