Skip to content

A simple text editor where you can add text and undo the last operation using both a stack and a queue.

Notifications You must be signed in to change notification settings

jepozdemir/csharp_queue_and_stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Queue vs Stack

This repository contains code samples and techniques referenced in my Medium blog post, "Queue vs. Stack in C#". This post and repository focus on understanding the differences between queues and stacks in C#, their use cases, and when to choose one over the other.

Overview

In this blog post, I discuss the fundamental differences between queues and stacks, two essential data structures in programming. Each structure is explained with code examples to demonstrate their unique behaviors and applications.

Topics Covered

  • Definition of Stack
    A stack is a last-in, first-out (LIFO) data structure where the last element added is the first one to be removed.

  • Definition of Queue
    A queue is a first-in, first-out (FIFO) data structure where the first element added is the first one to be removed.

  • Key Operations

    • Stack: Push, Pop, Peek
    • Queue: Enqueue, Dequeue, Peek
  • Use Cases
    Discuss scenarios where stacks and queues are most effective, such as:

    • Stacks for function calls, backtracking algorithms, and undo mechanisms.
    • Queues for scheduling tasks, breadth-first search, and managing requests.

How to Use

  1. Read the Blog Post: Start by reading the full blog post on Medium here.
  2. Explore Code Samples: Review the repository for code examples demonstrating both stacks and queues in C#.
  3. Practice Implementing: Use the provided examples to practice implementing queues and stacks in your own C# projects.

Contributing

Contributions are welcome! If you have suggestions for improvements or additional examples, feel free to open an issue or submit a pull request.

Feedback and Suggestions

If you have any feedback on the blog post or this repository, please leave a comment on the Medium post or reach out through GitHub issues.

License

This project is licensed under the MIT License.

Thank you! If you found this helpful and would like to show support; don't forget to give it a star and share it with others who might benefit from it.👏👏👏👏👏