0% found this document useful (0 votes)
42 views

Algorithms

Uploaded by

Younes Bennini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Algorithms

Uploaded by

Younes Bennini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

MASTERING ALGORITHMS

Your cheat sheet to becoming a champion in algorithms

Younes Fadil
Barmij Academy

March 26, 2024


DISCLAIMER

© Barmij Academy
All Rights Reserved

The information provided in the “Roadmap to Becoming a Data Analyst” Cheat Sheet is for general
informational and educational purposes only. It is distributed free of charge and is not to be sold. While we
strive to keep the information up to date and correct, we make no representations or warranties of any kind,
expressed or implied, about the completeness, accuracy, reliability, suitability, or availability with respect to
the Cheat Sheet or the information, products, services, or related graphics contained in the Cheat Sheet for any
purpose. Any reliance you place on such information is therefore strictly at your own risk.

This Cheat Sheet is provided as a free resource and is not intended to be a substitute for professional advice.
Before taking any actions based on such information, we encourage you to consult with the appropriate
professionals. The use of this Cheat Sheet is at your own discretion and risk.

In no event will we be liable for any loss or damage including without limitation, indirect or consequential
loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in
connection with, the use of this Cheat Sheet.

Through this Cheat Sheet, you might be able to link to other websites which are not under the control of
Barmij Academy or its members. We have no control over the nature, content, and availability of those sites.
The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed
within them.

Every effort is made to keep the Cheat Sheet up to date. However, Barmij Academy and its members take no
responsibility for, and will not be liable for, the Cheat Sheet being temporarily unavailable due to technical
issues beyond our control.
ROADMAP TO BECOMING A DATA ANALYST

TABLE OF CONTENTS

Algorithms mastery ............................................................................................................................ 4

Build a Strong Foundation ............................................................................................................. 4


Learn Core Algorithms ................................................................................................................... 5
Practice .............................................................................................................................................. 6
Deepen your Understanding ......................................................................................................... 6

PAGE 3 OF 7
Copyright © 2022 – Barmij Academy
ROADMAP TO BECOMING A DATA ANALYST

ALGORITHMS MASTERY

L earning algorithms is a gateway to sharper thinking and problem-solving. It equips you


with a structured approach to tackle complex problems, translating to better decision-
making in all areas of life. By analyzing algorithms, you not only strengthen critical thinking
and logic but also gain a deeper understanding of the technology that shapes our world. Even
basic knowledge improves your coding skills and provides a cognitive boost, keeping your
mind agile and adaptable. In short, learning algorithms is an investment in your overall
problem-solving prowess and mental fitness.

Build a Strong Foundation


a. Data Structures: Master fundamental data structures like arrays, linked lists, stacks,
queues, trees, and graphs. Grasp how they store and manipulate data efficiently.

What are some good resources for learning Data Structures?

 MIT OpenCourseWare: Introduction to Algorithms Massachusetts Institute


of Technology: https://ocw.mit.edu/courses/6-006-introduction-to-
algorithms-spring-2020/ This course by MIT is a classic for a reason. Professor
Charles Leiserson guides you through the fundamentals of algorithmic
thinking and problem-solving using common data structures.

The videos are in English but you can add automatic translation to Arabic if
you wish to.

 FreeCodeCamp: Data Structures and Algorithms


FreeCodeCamp: https://www.freecodecamp.org/news/learn-data-structures-
and-algorithms/ This course by FreeCodeCamp is a great option for

PAGE 4 OF 7
Copyright © 2022 – Barmij Academy
ROADMAP TO BECOMING A DATA ANALYST

beginners. It provides a gentle introduction to data structures using


JavaScript.

b. Big-O Notation: Understand how to analyze algorithm complexity using Big-O


notation. This helps you measure how efficient an algorithm is in terms of time and
space usage.

You can read more on Big-O notation in the following sources.

 Codecademy - Big-O Notation


https://www.codecademy.com/resources/docs/general/big-o-notation : This
interactive guide from Codecademy provides a clear explanation of Big-O
notation with visualizations and practice problems.
 MIT OpenCourseWare - Introduction to Algorithms (textbook)
[Massachusetts Institute of Technology ocw.mit.edu] : While the entire
course material might be extensive, the MIT OpenCourseWare textbook for
Introduction to Algorithms has a dedicated chapter on analyzing algorithms
with Big-O notation (Chapter 3). You can access it freely.

Learn Core Algorithms


 Sorting Algorithms: Start with basic sorting algorithms like bubble sort, selection
sort, insertion sort, then move on to merge sort and quick sort.
 Searching Algorithms: Learn linear search, binary search, and understand their time
complexities.
 Graph Algorithms: Explore algorithms for traversing graphs (DFS, BFS), shortest
path algorithms (Dijkstra's), and topological sorting.

This video from MIT OpenCourseWare explains in details the different types of
algorithms (Sort, Search)

https://www.youtube.com/watch?v=6LOwPhPDwVc

Also, this free online book is a valuable resource to learn more about Algorithms in
general

Introduction to Algorithms (Fourth Edition)

PAGE 5 OF 7
Copyright © 2022 – Barmij Academy
ROADMAP TO BECOMING A DATA ANALYST

Practice
Once you grasp the concepts of the core algorithms, you have to put them into practice.
The following online platform offer a range of problems from beginner to advanced levels
where you can hone your abilities.

 LeetCode: https://leetcode.com/
 HackerRank: https://www.hackerrank.com/
 CodeWars: https://www.codewars.com/
 Codeforces: https://codeforces.com/problemset

Remember, when solving problems on these platforms, try solving the problems on
your own before resorting to hints or solutions. This will help you build problem-
solving muscle.

Deepen your Understanding


As you progress, delve into more advanced algorithms:

1. Divide and Conquer (D&C): This technique breaks down a problem into smaller,
independent subproblems that are identical or similar to the original problem. It
follows these steps:
o Divide: Break the problem into smaller subproblems.
o Conquer: Solve each subproblem recursively (calling the function itself) or
directly.
o Combine: Combine the solutions of the subproblems to get the solution to the
original problem.

• Applications: Sorting (Merge Sort, Quick Sort), Searching (Binary Search), etc.

2. Greedy Algorithms: These algorithms make the optimal choice at each step with the
hope of finding a global optimum solution. They are well-suited for problems where
a locally optimal choice also leads to a global optimal solution.

• Applications: Finding the shortest path (Dijkstra's algorithm), Activity


scheduling, Fractional knapsack problem, etc. Be aware that greedy algorithms
might not always find the optimal solution.

PAGE 6 OF 7
Copyright © 2022 – Barmij Academy
ROADMAP TO BECOMING A DATA ANALYST

3. Dynamic Programming (DP): This technique solves problems by breaking them


down into overlapping subproblems and storing the solutions to these subproblems
to avoid recomputing them. It is useful when solving problems with optimal
substructure (where solutions to subproblems are used to build solutions to larger
problems).

• Applications: Shortest path (Floyd-Warshall algorithm), String Edit Distance,


Knapsack problem (where item weights are not fractions), etc.

4. Backtracking: This technique explores all possible solutions recursively by trying


different options at each step. It backtracks from dead ends and explores alternative
paths.

• Applications: Maze solving, N-Queens problem (placing N queens on a


chessboard such that no two queens can attack each other), Sudoku Solver, etc.

5. Brute Force: This is a straightforward approach where you try all possible solutions
systematically until you find the desired one. It can be inefficient for large problem
sizes.

• Applications: Used as a baseline for comparison with more efficient algorithms.


Sometimes used for simple problems or when no better approach is known.

These are just a few examples, and the choice of technique depends on the specific
problem you are trying to solve.

Happy Coding.

PAGE 7 OF 7
Copyright © 2022 – Barmij Academy

You might also like