We’ve learned about Queues, and discovered that queues are processed First In, First Out (FIFO). Essentially, this means: A priority queue is an abstract data type similar to a regular queue or stack data structure in which each eleemnt additionally has a “priority” associated with it. In a priority queue,…
Mastering HashSet in C#: Efficient Data Storage and Retrieval
A HashSet (sometimes called a “set”) is one the most utilized data structures in LeetCode style interviews and has tremendous power when it comes to optimizing algorithms. Hashsets are popular across all popular languages and fundamental concept to computer science. A set is a collection of distinct objects without duplicated…
Transform Your Data Handling with C# SelectMany
SelectMany in C# is a method used primarily with LINQ (Language-Integrated Query) to project each element of a sequence to an IEnumerable<T> and flatten the resulting sequences into one sequence. In simpler terms, it helps you deal with collections within collections by merging them into a single collection. Here’s a…
From Nodes to Greatness: Understanding Linked Lists in C#
Very similar to an array, a linked list is a data structure that represents a collection of items. While on the surface, they are identical there are big differences under the hood. Memory inside of a computer can be visualized as a giant excel spread sheet. When you store an…
Deep Dive into C# Dictionaries: Performance and Optimization
Imagine that you are coding a program that allows customers to order vapes online. You are tasked with making a menu that displays different types of vapes on a company website. While this array is useful and innocent, this design has many downsides including: O(N) runtime is not exactly the…
Bubble Sort in C#: Step-by-Step Implementation
Sorting algorithms have been the subject of massive research in computer science. They all are trying to solve the some problem. Given an array of unsorted values, how can we sort them so that they end up in ascending order? Bubble Sort is a sorting algorithm with the following steps:…
C# Recursion: Simple Concepts, Powerful Results
Recursion is a foundational computer science concept that many concepts are built on top of. Recursion can elegantly solve many algorithms or it can create massive time complexities that ruin your code. But before jumping into the deep end, let’s start simple. Recursion is the term for a function calling…
Queues in C#: Leveraging FIFO for Optimal Performance
A queue is a data structure that is designed to process temporary data. Just like a stack, it processes data but it a different order. Just like a stack, a queue is built from existing data structures; therefore, it is an abstract data type. The best way to think of…
From Theory to Practice: Implementing Stacks in C#
A stack stores data in the same way arrays do. In fact, a stack data structure is actually just an array with limitations. The purposeful “limitations” that we place on stacks are: Push, pop, and peek are operations given to the stack, because it closely resembles a stack of plates….