Data structures and Algorithms for Noobs

Still figuring that out
Data structures and algorithms are very essential is software development or any other computer science related field. So important, yet so easily misunderstood. If you intend working at a large tech company, you must have the fundamentals of data structures and algorithms under your belt.
This is a 3 part series where I explain data structures and algorithms in lay man terms.
By the end of this course, you'll know the following:
- what an algorithm is
- what a data structure is
- how certain data structures work
- when to use certain data structures
Table of Contents
- introduction
- Prerequisites
- stack
- queue
- set
- conclusion
Introduction
Welcome to part 1 of my data structures and algorithm course. In this part, we'll cover three data structures: stack, queue and set.
What are Algorithms?
Algorithms are simply the steps taken to achieve a task. Simple right?
What are Data structures?
Think of data structures as containers used to hold data. You wouldn't want to use a basket to fetch water would you? Hence, the importance of knowing when to use certain data structures.
Prerequisites
No prerequisites required.
Stack
A stack is a type of a data structure. Think of stack like a pile of books; The book at the top of the pile was placed last. However, it will be the first to be removed from the pile of books. A stack works in a last in, first out manner.
Stacks have the following methods:
pushwhich adds an element to the top of the stackpopwhich removes the element at the top of the stack and returns itpeekwhich returns the first element at the stacksizeorlengthwhich returns the length of the stack
Queue
A queue is just like a stack. The only difference is that it works in a first in, first out manner. Imagine you're on a queue at the airport. Who will be the first person to get attended to? You guessed it right! The first person at the queue. However, there is an exception. If someone like the president is on that same queue, he will get attended to first. In programming, you call that a priority queue.
Queues have the following methods:
enqueuewhich adds an element to the queuedequeuewhich removes the first element at the queuefrontwhich returns the first element at the queuesizewhich returns the length of the queueisEmptywhich returns a boolean (true or false) depending on if the queue is empty or not
Set
A set is simply an array that has no duplicate items. Sets are useful when checking if an item is present in an array. A grocery list is an example of a set.
Sets have the following methods:
haswhich returns a boolean (true or false) depending on if an element is present in a set or notunionwhich joins two sets and returns the resultdifferencewhich returns the elements that are present in one set but not in the other setremovewhich deletes an element from a setintersectionwhich returns elements that are present in both sets
Conclusion
You have completed part 1 of my data structures and algorithm course. By now, you know what stacks, sets, and queues are. With this knowledge, I urge you to implement them in any programming language of your choice. I'll be happy to see your implementation.
Stay safe :)

