# Data Structures and Algorithms in Python – Full Course for Beginners

August 28, 2024 2024-08-28 6:13## Data Structures and Algorithms in Python – Full Course for Beginners

A beginner-friendly introduction to common data structures (linked lists, stacks, queues, graphs) and algorithms (search, sorting, recursion, dynamic programming) in Python. This course will help you prepare for coding interviews and assessments.

🔗 Course website: https://jovian.ai/learn/data-structures-and-algorithms-in-python

✏️ Created by Aakash N S, founder and CEO of Jovian.

⭐️ Course Lessons with Code ⭐️

🟢 Lesson 1 – Binary Search, Linked Lists and Complexity

💻 Linear and Binary Search: https://jovian.ai/aakashns/python-binary-search

💻 Problem Solving Template: https://jovian.ai/aakashns/python-problem-solving-template

💻 Linked Lists in Python: https://jovian.ai/aakashns/python-classes-and-linked-lists

🟢 Assignment 1 – Binary Search Practice

💻 Starter Notebook: https://jovian.ai/aakashns/python-binary-search-assignment

🟢 Lesson 2 – Binary Search Trees, Traversals and Recursion

💻 Binary Search Trees in Python: https://jovian.ai/aakashns/python-binary-search-trees

💻 Problem Solving Template: https://jovian.ai/aakashns/python-problem-solving-template

💻 Linked Lists in Python: https://jovian.ai/aakashns/python-classes-and-linked-lists

🟢 Assignment 2 – Hash Tables and Python Dictionaries

💻 Starter Notebook: https://jovian.ai/aakashns/python-hash-tables-assignment

🟢 Lesson 3 – Sorting Algorithms and Divide & Conquer

💻 Sorting and Divide & Conquer: https://jovian.ai/aakashns/python-sorting-divide-and-conquer

💻 Problem Solving Template: https://jovian.ai/aakashns/python-problem-solving-template

🟢 Assignment 3 – Divide and Conquer Practice

💻 Starter Notebook: https://jovian.ai/aakashns/python-divide-and-conquer-assignment

🟢 Lesson 4 – Recursion and Dynamic Programming

💻 Problem-solving template: https://jovian.ai/aakashns/python-problem-solving-template

💻 Dynamic Programming problems: https://jovian.ai/aakashns/dynamic-programming-problems

🟢 Lesson 5 – Graph Algorithms (BFS, DFS & Shortest Paths)

💻 Graphs and Graph Algorithms (Starter Notebook): https://jovian.ai/aakashns/python-graph-algorithms

🟢 Project – Step-by-Step Solution to a Programming Problem

💻 Starter Notebook: https://jovian.ai/aakashns/python-problem-solving-template

🟢 Lesson 6 – Python Interview Questions, Tips & Advice

💻 Problem solving template: https://jovian.ai/aakashns/python-problem-solving-template

💻 Coding problem 1: https://jovian.ai/aakashns/python-subarray-with-given-sum

💻 Coding problem 2: https://jovian.ai/aakashns/python-minimum-edit-distance

⭐️ Course Contents ⭐️

⌨️ (00:00:00) Introduction

⌨️ (00:01:43) Binary Search Linked Lists and Complexity

⌨️ (00:03:43) Introduction

⌨️ (00:08:35) Problem

⌨️ (00:12:17) The Method

⌨️ (00:13:55) Solution

⌨️ (00:50:52) Complexity and Big O notation

⌨️ (01:24:57) Binary Search vs Linear Search

⌨️ (01:31:40) Generic Binary Search

⌨️ (01:40:08) Summary and Conclusion

⌨️ (01:44:30) Assignment Walkthrough

⌨️ (01:45:05) Introduction

⌨️ (01:50:01) Problem- Rotated Lists

⌨️ (01:53:02) The Method

⌨️ (01:54:03) Solution

⌨️ (02:30:47) Summary and Conclusion

⌨️ (02:33:29) Binary Search Trees Python Tutorial

⌨️ (02:34:41) Introduction

⌨️ (02:37:36) Problem

⌨️ (02:38:40) The Method

⌨️ (03:13:58) Binary tree

⌨️ (03:27:16) Traversing Binary Tree

⌨️ (03:36:10) Binary Search Tree

⌨️ (04:22:37) Self-Balancing Binary Trees and AVL Trees

⌨️ (04:26:27) Summary and Conclusion

⌨️ (04:30:33) Hash Tables and Python Dictionaries

⌨️ (04:31:09) Introduction

⌨️ (04:34:00) Problem

⌨️ (04:40:28) Data List

⌨️ (04:42:52) Hash Function

⌨️ (04:54:52) Basic Hash Table Implementation

⌨️ (05:03:07) Handling Collisions with Linear Probing

⌨️ (05:09:24) Summary and Conclusion

⌨️ (05:16:47) Sorting Algorithms and Divide & Conquer

⌨️ (05:17:48) Introduction

⌨️ (05:20:19) Problem

⌨️ (05:21:27) The Method

⌨️ (06:40:49) Custom Comparison Functions

⌨️ (06:48:53) Summary and Conclusion

⌨️ (06:54:57) Recursion Memoization & Dynamic Programming

⌨️ (06:56:37) Introduction

⌨️ (07:00:04) Problem

⌨️ (07:04:28) The Method

⌨️ (07:06:21) Solution

⌨️ (08:06:13) Knapsack Problems

⌨️ (08:08:48) The Method

⌨️ (08:09:24) Solution

⌨️ (08:43:26) Summary and Conclusion

⌨️ (08:44:05) Graph Algorithms BFS, DFS & Shortest Paths

⌨️ (08:45:02) Introduction

⌨️ (08:51:00) Graph Data Structure

⌨️ (09:15:57) Graph Algorithms – Breadth-First Search

⌨️ (09:37:28) Depth-First Search

⌨️ (10:08:26) Shortest Paths

⌨️ (10:40:39) Summary and Conclusion

⌨️ (10:42:21) Python Interview Questions Tips & Advice

⌨️ (10:43:09) Introduction

⌨️ (10:44:08) The Method

⌨️ (10:47:10) Solution

⌨️ (12:30:51) Summary and Conclusion

source

## Comments (43)

## @venkatasivavarmasirivuri231

Hey guys this course has no arrays concept

## @venkatasivavarmasirivuri231

Which one is better guys neetcode or this course

## @jo_yousef7170

This it to keep track where I am in the video:

01:44:44

## @sarahsleeptight8343

hello jovian website cannot be accessed

## @cristibtz

To know where I remained:

48:30

## @An_urag9

You skipped the linked list part

## @LeelaSankharM

checkpoints for myself:

4. 2:33:29

3. 1:45:00

2. 1:14:00

1. 45:00

## @Alternatywny_1

Now I'm to tired but I will try this tutorial starting from tomorrow, 1 hour per day and write results here 😊

## @tienesmalaliento

1:25:29

## @oyca-bp3rn

Is this course enough to start learninng or be programmer

## @user-zn7sk2rc8g

3:23:49

## @thebadguy4068

I see that your binary search algorithm only work for decreasing order not work for increasing order , we need to slightly change the code….

#this code will work in both way

def test_case(cards, query, mid, ascending=True):

mid_num = cards[mid]

if mid_num == query:

return 'found'

elif ascending:

if mid_num < query:

return 'right'

else:

return 'left'

else: # Descending order

if mid_num < query:

return 'left'

else:

return 'right'

def locate_card(cards, query, ascending=True):

lo, hi = 0, len(cards) – 1

while lo <= hi:

mid = (lo + hi) // 2

result = test_case(cards, query, mid, ascending)

if result == 'found':

return mid

elif result == 'left':

hi = mid – 1

elif result == 'right':

lo = mid + 1

return -1

# Test case for descending order

testcases_descending = {

'input': {

'cards': list(range(10, 0, -1)), # Descending order list

'query': 1

},

'output': 9 # Expected output index

}

result_descending = locate_card(testcases_descending['input']['cards'], testcases_descending['input']['query'], ascending=False)

if result_descending == testcases_descending['output']:

print("Found the card in descending order")

else:

print("Card not found in descending order")

## @xyz-vv5tg

Is heaps/stacks included?

## @krutikabarad4241

Okay not to complain, but there's so much time spent on explaining his website rather than actually focusing on teaching

## @harshgamer6105

awesome teaching sir!

## @Okeokokokok

1:32:57

## @saiki8777

2:37:00

## @sivagoram8208

`I am starting this course today but while enrolling this course it's showing the to upgrade the course by paying money for getting the certification please help me anyone how to upgrade this course freely friends

## @saiki8777

1:59:00

## @saiki8777

1:42:00

## @gnomeunknown4717

3:25:00

## @sarahriehe5297

00:00

## @amisikade

Keeping track of my progress:

1:04:33, 1:44:15

## @preshamonga3603

is linked list not covered in this video?

## @aribasiddiqi3982

I like the problem solving template approach to coding! But I do wish the instructor spent less time explaining how to use the platform

## @Kau093

Using this to prepare for my Netflix interview tomorrow, will update on how it goes 😅

## @ahmedkhalid6481

Thank you so much !

## @Jamaalmamu

Simplest solution for the first problem:

Gemini write a function which takes a list of integers and a integer and then if the given integer exist in the given list of integers return its index or else return -1

## @ForRo3sS

Now ı will first do this gentelman’s project on flask and python then ı wil devour this course as many times it takes! I am really thankful to you guys. When ı find a job ı will be an avid supporter!!

## @ashrafulislammahi5127

Does it cover stack and Queue?

## @william2jz

Bro spent more time explaining his website than actually explaining the material

## @waildjerroudib9630

⌨ (00:00:00) Introduction

⌨ (00:01:43) Binary Search Linked Lists and Complexity

⌨ (00:03:43) Introduction

⌨ (00:08:35) Problem

⌨ (00:12:17) The Method

⌨ (00:13:55) Solution

⌨ (00:50:52) Complexity and Big O notation

⌨ (01:24:57) Binary Search vs Linear Search

⌨ (01:31:40) Generic Binary Search

⌨ (01:40:08) Summary and Conclusion

⌨ (01:44:30) Assignment Walkthrough

⌨ (01:45:05) Introduction

⌨ (01:50:01) Problem- Rotated Lists

⌨ (01:53:02) The Method

⌨ (01:54:03) Solution

⌨ (02:30:47) Summary and Conclusion

⌨ (02:33:29) Binary Search Trees Python Tutorial

⌨ (02:34:41) Introduction

⌨ (02:37:36) Problem

⌨ (02:38:40) The Method

⌨ (03:13:58) Binary tree

⌨ (03:27:16) Traversing Binary Tree

⌨ (03:36:10) Binary Search Tree

⌨ (04:22:37) Self-Balancing Binary Trees and AVL Trees

⌨ (04:26:27) Summary and Conclusion

⌨ (04:30:33) Hash Tables and Python Dictionaries

⌨ (04:31:09) Introduction

⌨ (04:34:00) Problem

⌨ (04:40:28) Data List

⌨ (04:42:52) Hash Function

⌨ (04:54:52) Basic Hash Table Implementation

⌨ (05:03:07) Handling Collisions with Linear Probing

⌨ (05:09:24) Summary and Conclusion

⌨ (05:16:47) Sorting Algorithms and Divide & Conquer

⌨ (05:17:48) Introduction

⌨ (05:20:19) Problem

⌨ (05:21:27) The Method

⌨ (06:40:49) Custom Comparison Functions

⌨ (06:48:53) Summary and Conclusion

⌨ (06:54:57) Recursion Memoization & Dynamic Programming

⌨ (06:56:37) Introduction

⌨ (07:00:04) Problem

⌨ (07:04:28) The Method

⌨ (07:06:21) Solution

⌨ (08:06:13) Knapsack Problems

⌨ (08:08:48) The Method

⌨ (08:09:24) Solution

⌨ (08:43:26) Summary and Conclusion

⌨ (08:44:05) Graph Algorithms BFS, DFS & Shortest Paths

⌨ (08:45:02) Introduction

⌨ (08:51:00) Graph Data Structure

⌨ (09:15:57) Graph Algorithms – Breadth-First Search

⌨ (09:37:28) Depth-First Search

⌨ (10:08:26) Shortest Paths

⌨ (10:40:39) Summary and Conclusion

⌨ (10:42:21) Python Interview Questions Tips & Advice

⌨ (10:43:09) Introduction

⌨ (10:44:08) The Method

⌨ (10:47:10) Solution

⌨ (12:30:51) Summary and Conclusion

## @wenkanglee9596

I don't think 7:36:00 is correct:

Memoization-exclusive time complexity doesn't seem to be 2^m+n, given m and n are the nums of elements in two sequences.

first, finding the longest common subsequence by quick sort would be meaningless if one of the lists/sequences is exhausted, regardless of the remainders within the other. That means, and as stated by the code itself, the code will stop getting rid of character/ element when there's no more comparison to take place, so making "all leaves end at 0, 0" unachievable. (They either stuck in a loop like (1, 0) would generate (1, 0) and (0, 0) or could not be proceeded further.)

So, based on the above, it looks like the tree is not a symmetrical binary and hence 2^x could no be induced from the statement "each element would cause two possible choices to be made". But when we tried that — 2^(m+n) — with small numbers, it does approximate what was stated and seemed to be true. Let's say [a, b] & [c, d]. but as the quantity of input gets exponentially larger, I'm no longer convinced that is still correct.

When we're given a fixed yet allocable nums of elements (you can see this as you gambling chips), the max num we could potentially get from them from a multiplication is through the minumum difference between the two numbers. (like how 2×2 > 1×3) So, the worst case where iteration would be at maximum, under the circumstance that total num of elements of both sequences are fixed, would be when seq1 and seq2 have the same number. And now what would be the other extreme case? I'm sure you can tell it's when there is only one element in seq1 and the remainder in seq2. The time complexity of that would be:

(2 x N of the longest sequence)+1

and the leaves would just be N+1.

Now let's get back to the "worst of worst" case. I've tried to construct the binary tree up to (4, 4) root and noticed it does resemble a perfect, symmetrical binary tree but with surplus leaves (the number of leaves after you filled out all the gaps left by a zero-sth pairs to make it a perfect binary). And my conclusion was that the time complexity should be of 2 to the power of the height of tree, instead of simply adding m and n. The increment or trend of the surplus leaves is a multiplication of 4 for every one element added to both sequences: I had 4 leaves at (2, 2), 8 at (3, 3), and 12 at (4, 4), so on and forth. And we know that exponent has a greater growing power than multiplication, so eventually the disparity between the number given by m+n and the surplus leaves would be exponentially greater.

From the sum of geometrical series, if we substitute a with 1 and r with 2, we know that the sum of all the nunber of nodes (including leaves) of a h-layer tree would be approximately 2^h. And for a same-number pair root, the height of the tree (excluding root and surplus leaves) is just 2n-2. On a side note, we can now deduce that if we toggle the number on the scale, let say from a fixed total of 10, the number of nodes would lie somewhere between 19 to ~256. Hence, it would be more intuitive (for me, personally) to say that the time complexity of the quick sort that without memoization would be ~ 2^h, for which h is the number of layers excluding root (or counting from 0 if you wanna do so). But, ultimately, it's just the matter of 2^n+2, so I assumed it doesn't affect much. In the end, worst case of memoization (which simply is m*n) would beat 2^(2n-2).

## @wenkanglee9596

I think there's an error at 6:37:47:

n + (n-1) … should = n*(n+1)/2, instead of minus one, but it shouldn't be a big deal because it's still O(n^2).

## @Keerthana_2005

Is this a best cource for 2nd year student?

## @fi9h

Who is watching this before exam 😂

## @NILENDUDAS-nb1ry

will this video taught me python also as i am a beginner ? please give reply….

## @alin98988

Hi I am getting problem when instlaling jovian library on kaggle. its says there is no module named jovian? any possible solutions?

## @syedfahad6501

Hi Akash, Just want to apprecite your work and the efforts you have put in this course, I am doing programming since long and currently working as an engineer, but this course changed the way of my programminng, have saw so many such course but this one is truly exceptional.

## @mabd10

1:39:13

## @Play_Streams

It would have been really nice to have chapter markers on this video, but this is gold.

## @Quack_34

coding interview*10000 , crux knowledge*0.000001 , here we go !

## @FunnyAcolyteExplains

FreeCodeCamp saving lives as always. Helped me with my college project with your extensive UI UX tutorials. And saving my exams with this