# What are Data Structures and Algorithms?

## What is a data structure?

A data structure is a particular way of organizing data in a computer. For example, we can store a list of items having the same data type using the array data structure.

## What is an Algorithm?

An algorithm is a set of well-defined instructions in sequence to solve a problem. Informally, an algorithm is nothing but a mention of steps to solve a problem. They are essentially a solution.

For example, an algorithm to add two numbers entered by the user might look something like this:
Step 1: Start
Step 2: Declare variables num1, num2, and sum.
Step 3: Read values num1 and num2.
Add num1 and num2 and assign the result to the sum. sum←num1+num2
Step 5: Display the sum.
Step 6: Stop

## Qualities of Good Algorithms

1. Input and output should be precisely defined.
2. Each step in the algorithm should be unambiguous.
3. Algorithms should be the most effective among many different ways to solve a problem.
4. An algorithm should not include computer code.

# Why should you learnData Structures and Algorithms?

Have you ever wondered why big companies like Google, Facebook, and Amazon hire programmers who are exceptionally good at optimizing Algorithms?

Programming is all about data structures and algorithms. Data structures hold data, while algorithms solve the problem using that data.

Data structures and algorithms (DSA) go through solutions to usual problems in detail and give you an insight into how efficient it is to use each one of them. It also teaches you the science of evaluating the efficiency of an algorithm. It enables you to choose the best of various choices.

Generally, software development involves learning new technologies daily. You get to know most of these technologies while using them in one of your projects. However, it is not the case with algorithms.
If you do not know algorithms well, you will not identify whether you can optimize the code. You are expected to know in advance and apply wherever possible and critical.

Write optimized and scalable code — Once you know different data structures and algorithms, you can determine which data structure and algorithm to choose in various conditions.

Effective use of time and memory — Knowing data structures and algorithms will help you write code that runs faster and requires less storage.

# How To Learn Data Structures And Algorithms?

YouTube and Google offer several complete series of easy-to-follow DSA tutorials along with suitable examples. These tutorials are for absolute beginners who want to dive into the field of computer programming.

## Learn DSA from Books

Learning from books is always a good practice. You will get a better picture of programming concepts in the books that you may not find elsewhere.

Introduction to Algorithms by Thomas H. Cormen: It is one of the most popular algorithm books, but it contains a heavy dose of theory.

Algorithms by Robert Sedgewick and Kevin Wayne: You will learn lots of background on the algorithms.

The Algorithm Design Manual by Steve S.Skiena: This is another excellent book on computer algorithms that go over many algorithms with code.

## Learn DSA through visualization

Once you have some idea about data structures and algorithms, you can look for a great resource called Data Structure Visualization which lets you learn through animations.

# Data Structures - The Ultimate Guide For Beginners

## What is a data structure?

A data structure is a particular way of organizing data in a computer. For example, we can store a list of items having the same data type using the array data structure.

## Eight common data structures every programmer must know:

Arrays: An array is a structure of fixed size, which can hold items of the same data type.

Linked Lists: A linked list data structure includes a series of connected nodes. Here, each node store the data and the address of the next node.

Stacks: A stack is just like a pile of plates kept on top of each other. It follows the Last In First Out(LIFO) principle.

Queues: It is similar to the ticket queue outside a cinema hall, where the first person entering the line is the first person who gets the ticket. It follows the First In First Out (FIFO) rule.

Hash Tables: The hash table is a data structure that stores elements in key-value pairs.

Trees: A tree is a hierarchical structure where data is organized hierarchically and linked together.

Heaps: Heap data structure is a complete binary tree that satisfies the heap property. It is also called a binary heap.

Graphs: A graph consists of a finite set of vertices or nodes and edges connecting these vertices.

## What is an Algorithm?

An algorithm is a set of well-defined instructions in sequence to solve a problem. Informally, an algorithm is nothing but a mention of steps to solve a problem. They are essentially a solution.

## Six algorithms every programmer must know:

Recursive Algorithm: In simple words, it’s an Algorithm that calls itself repeatedly until the problem is solved.

Divide and Conquer Algorithm: Divide the algorithm into two parts; the first parts divide the problem on hand into smaller subproblems of the same type. Then, in the second part, these problems are solved and then added together to produce the final solution.

Dynamic Programming Algorithm: These algorithms work by remembering the results of the past run and using them to find new solutions.

Greedy Algorithm: In this algorithm, a decision is made that is good at that point without considering the future.

Brute Force Algorithm: A brute force algorithm blindly iterates all possible solutions to search for one or more than one solution that may solve a function.

Backtracking Algorithm: Backtracking is a technique to find a solution to a problem in an incremental approach. It solves a problem recursively and tries to solve it at a time. If one of the solutions fails, we remove it and backtrack to find another solution.

# Your new favorite daily ritual.

Socials:

Instagram — https://www.instagram.com/developedbydeon