Algorithms by Sharma Thankachan
Algorithms by Sharma Thankachan
  • 18
  • 107 221
2.11 - Integer Sorting Algorithms | Counting Sort and Radix Sort
Counting sort and radix sort are specialized algorithms for sorting integers. Given n integers within the range [0, k-1], counting sort takes O(n+k) time, which is optimal if k = O(n). Radix sort takes O(n + n* (log k)/(log n)) time, which is optimal if k = O(n^c) for any constant c.
มุมมอง: 892

วีดีโอ

2.8 - Probability Basics | Randomized Algorithms | Hiring Problem | Coupons Collector
มุมมอง 1.8K3 ปีที่แล้ว
A quick review of the following topics: random experiment, sample space, event, probability, random variable, indicator random variable, expectation of a random variable, linearity of expectation, Bernoulli trial, Markov's inequality, randomized algorithms (Monte Carlo vs Las Vegas) and probability puzzles (the hiring problem and coupons collector problem).
2.10 - Quick Select | Randomized Algorithms
มุมมอง 2K4 ปีที่แล้ว
A simple Randomized (Las Vegas) algorithm for expected linear time selection.
2.9 - Quick Sort | Randomized Algorithms (Monte Carlo vs Las Vegas)
มุมมอง 2.6K4 ปีที่แล้ว
A simple Randomized (Las Vegas) algorithm for sorting in expected O(n log n) time. This can be converted to a Monte Carlo algorithm with O(n log n) worst case time.
2.7 - Finding the MIN/MAX slope (of lines connecting points in 2D) and its Counting Version
มุมมอง 1.4K4 ปีที่แล้ว
Given a set of n points in 2D, we need to compute: (i) the pair of points such that the slope of the line segment connecting them is the MAXIMUM, (ii) the pair of points such that the slope of the line segment connecting them is the MINIMUM, and (iii) count the number of pairs such that the slope of the line segment connecting them is within a given range. All three problems can be solved in O(...
2.6 - Counting Inversions in an Array in O(n log n) time via Divide and Conquer
มุมมอง 12K4 ปีที่แล้ว
Given an array A[1,n] of numbers, we need to count the number of inversions. As inversion is a pair of positions (i, j), such that i is smaller than j, but i-th element is larger than j-th element (i.e, the elements are out of order with respect to sorted order). This can be solved in O(n log n) time via a Divide and Conquer algorithm.
2.5 - Closest Pair of Points using Divide and Conquer algorithm in O(n log n) time.
มุมมอง 44K4 ปีที่แล้ว
Given a set of n points in 2 dimension, find the pair of points, such that the euclidean distance between them is the minimum. The trivial algorithm takes O(n^2) time, however, we can solve this in O(n log n) time using Divide and Conquer strategy.
2.4 - Integer Multiplication (Karatsuba's Algo) & Matrix Multiplication (Strassen's Algo)
มุมมอง 1.5K4 ปีที่แล้ว
Two fundamental algorithms are discussed in this lecture: (i) Karatsuba's algorithm for fast multiplication of two n-digit numbers in time n^{log 3} = O(n^{1.59}), improving the trivial O(n^2) algorithm, and (ii) Strassen's algorithm for fast multiplication of two nXn matrices in time n^{log 7} = O(n^{2.81}), improving the trivial O(n^3) algorithm. Both algorithms are based on the divide and co...
2.3 - Binary search (in 1D and 2D arrays - upper and lower bounds) and Bitonic search
มุมมอง 1.5K4 ปีที่แล้ว
Searching in a sorted sequence can be done in O(log n) time via Binary search. A modified binary search can be used to do sorting in a Bitonic sequence (i.e., numbers are first increasing, then decreasing). Finally, given a 2D array of "n" columns and "n" rows, where elements are sorted both column wise and row wise, we can do searching in O(n) time. Additionally, we can prove that O(n) time is...
2.2 - Linear Time Selection (Median of Medians Algorithm)
มุมมอง 23K4 ปีที่แล้ว
The selection problem asks to report the kth smallest element in an unsorted array. It is easily solvable in O(n log n) time via sorting and the Median of Medians Algorithm solves this in O(n) time via a clever Divide and Conquer strategy.
2.1 - Lower Bound for (Comparison Based) Sorting
มุมมอง 5K4 ปีที่แล้ว
Using a decision tree view, we prove that any comparison-based sorting algorithm must perform Omega(n log n) comparisons, which is the minimum over the heights of all binary trees with n! leaves. Therefore, merge sort runs in optimal time.
2.0 - Sorting Algorithms (Selection, Insertion and Merge Sort) with Analysis
มุมมอง 1.6K4 ปีที่แล้ว
Three "COMPARISON BASED" sorting algorithms - Selection Sort, Insertion Sort (time complexity is quadratic), and the optimal O(n log n) time Merge sort, which uses the DIVIDE & CONQUER strategy.
1.5 - Growth of Functions and Asymptotic Notations
มุมมอง 2.1K4 ปีที่แล้ว
Big-O, Big-Omega, Small-o, Small-omega, and Theta.
1.4 - Warm-up problem (Maximize your the amount of your drink + Harmonic Series)
มุมมอง 7654 ปีที่แล้ว
Here is a simple game, where there are given "n" empty cups (with capacity "n" liters). The game is played between two players A and B. For round 1 to n-1, player A gets to 1 liter of drink and is allowed to distribute it across this "n" cups and then player B chooses one cup and empties it. At the last (i.e., nth) step, player B will not participate. Instead, player A will get to choose a cup ...
1.3 - Warm-up Problem (Separate HEAVY and LIGHT coins)
มุมมอง 9844 ปีที่แล้ว
You are given "n" coins, where coins are of two types - HEAVY and LIGHT. All HEAVY coins are of the same weight, and all LIGHT coins are of the same weight, but heavy coins are heavier than the light coins. Your task is to separate these coins into two groups - i.e., a group of all LIGHT coins and a group of all HEAVY coins. All coins look the same and the only instrument you have is a traditio...
1.2 - Warm-up problem (Find the Max and the Second Max)
มุมมอง 1K4 ปีที่แล้ว
1.2 - Warm-up problem (Find the Max and the Second Max)
1.1 - Warm-up problem (Find the Min and the Max)
มุมมอง 1.1K4 ปีที่แล้ว
1.1 - Warm-up problem (Find the Min and the Max)
1.0 - Introduction
มุมมอง 3.6K4 ปีที่แล้ว
1.0 - Introduction

ความคิดเห็น

  • @Lack_Of_Enemies
    @Lack_Of_Enemies 11 วันที่ผ่านมา

    made it so clear

  • @jtrigoura1
    @jtrigoura1 หลายเดือนก่อน

    Absolutely goated explanation

  • @JeetDaiya-d6j
    @JeetDaiya-d6j หลายเดือนก่อน

    Amazing Explaination Sir!!

  • @ARYANSINGH-hz8ly
    @ARYANSINGH-hz8ly หลายเดือนก่อน

    Very helpful lectures...Pls continue with more videos!

  • @sairajkarnik7362
    @sairajkarnik7362 หลายเดือนก่อน

    Congratulations! on 1k Subs

  • @xiaoyatang22
    @xiaoyatang22 2 หลายเดือนก่อน

    Respect sir! When I looked at the slides I got really really confused. Saved by you!

  • @narayananishanth7357
    @narayananishanth7357 3 หลายเดือนก่อน

    Excellent video 😊

  • @Mmmmmhm
    @Mmmmmhm 3 หลายเดือนก่อน

    i cannot understand how you do n steps then say that it takes n^2, i cannot wrap my head around this please clarify. like at 11:22.

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 3 หลายเดือนก่อน

      "n" step, and kth step takes roughly "k" time. So, total time for steps k = 1,2,3,..n is Big-O of (1+2+3+...+n), which is n(n+1)/2 [arithmetic progression], which can be written as O(n^2).

  • @mehdiboudour
    @mehdiboudour 3 หลายเดือนก่อน

    Thank you sir, finally understood it thanks to you.

  • @radhe_krashna
    @radhe_krashna 4 หลายเดือนก่อน

    why it is 7

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 3 หลายเดือนก่อน

      its clear in the proof, there are 8 boxes, so if we fix one box for one point, they we have other 7 possible boxes for the other point

    • @radhe_krashna
      @radhe_krashna 3 หลายเดือนก่อน

      @@algorithmsbysharmathankach7521 it should be 4 rather than 7

  • @sukhmanjitsingh2705
    @sukhmanjitsingh2705 6 หลายเดือนก่อน

    For correctness of we are comparing points sorted by y axis, what if there are 7 points in the other quadrant more than d distance away and 1 point directly underneath which is super close we missed that point and in end gave inaccurate result

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 6 หลายเดือนก่อน

      Suppose "p" is the current point and "q" is the other point (which is super close and underneath p) and (p,q) is the closest pair. You are right, this pair wont be captured while doing our procedure at "p", but it will be captured when we do our procedure at "q''.

    • @sukhmanjitsingh2705
      @sukhmanjitsingh2705 6 หลายเดือนก่อน

      @@algorithmsbysharmathankach7521 we take a look at next 7 points right and not the ones that are already scanned

    • @sukhmanjitsingh2705
      @sukhmanjitsingh2705 6 หลายเดือนก่อน

      @@algorithmsbysharmathankach7521 the points are sorted by y co ordinate and we check with next 7 points not previous ones

  • @gurmeet0108
    @gurmeet0108 6 หลายเดือนก่อน

    Very very well done video, thanks a lot for sharing.

  • @KshitijGupta-r8p
    @KshitijGupta-r8p 6 หลายเดือนก่อน

    good explanation

  • @anonymousstudent2182
    @anonymousstudent2182 7 หลายเดือนก่อน

    fantastic explanation

  • @adityaband6919
    @adityaband6919 8 หลายเดือนก่อน

    Amazing

  • @kelstonkkk
    @kelstonkkk 8 หลายเดือนก่อน

    Thanks you, best explanation of this I have seen so far

  • @saichaithrik7134
    @saichaithrik7134 8 หลายเดือนก่อน

    your explanation is one of the best I have seen thank you so much sir

  • @ktmi3037
    @ktmi3037 8 หลายเดือนก่อน

    this is great! thank you! why don't professors explain in a similar manner instead of showing 20 slides for 40 min...

  • @dmitricherleto8234
    @dmitricherleto8234 8 หลายเดือนก่อน

    I understand that each box can have at most one point but why do we even need to compare 7 since the distance on the left half or right half region is at most d. Why don't we just compare the points between the two regions?

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 8 หลายเดือนก่อน

      Yes, we can fix a point (on a side) and just compare it with 4 (instead of 7) points on the other side. But these 4 points can be anyone's among the next 7 points (if we sort with respect to Y). So, we might still need to examine the next 7 points. The answer is yes, we can do a bit of optimization here, but the asymptotic time will be the same.

  • @shubhadeepchatterjee5657
    @shubhadeepchatterjee5657 9 หลายเดือนก่อน

    Hey Sir, your videos are nice. Why your videos not coming up?

  • @NairutyaPatel
    @NairutyaPatel 9 หลายเดือนก่อน

    this is the exact explanation i was looking for. Very well explained

  • @NirmalSharonJoji
    @NirmalSharonJoji 9 หลายเดือนก่อน

    Thank you, Amazing video !!

  • @ZephyrrCummins
    @ZephyrrCummins 9 หลายเดือนก่อน

    Very well explained !!

  • @valeriacarrillo9193
    @valeriacarrillo9193 9 หลายเดือนก่อน

    thank you so much this helped a lot!!!

  • @sunilthunga5662
    @sunilthunga5662 9 หลายเดือนก่อน

    Excellent Explanation!

  • @claywrentz3119
    @claywrentz3119 10 หลายเดือนก่อน

    Thank you beast

  • @Shivammishra-x2x
    @Shivammishra-x2x ปีที่แล้ว

    very informative

  • @suryaram6874
    @suryaram6874 ปีที่แล้ว

    ❤‍🔥

  • @janapalaswathi4262
    @janapalaswathi4262 ปีที่แล้ว

    Well explained.. 👏

  • @flashdude64
    @flashdude64 ปีที่แล้ว

    holy shit I was looking for an understanding of why its 7 points. you are the most clear an concise. thank you

  • @shantipriya370
    @shantipriya370 ปีที่แล้ว

    thank you so much..

  • @animanoukiann
    @animanoukiann ปีที่แล้ว

    I appreciate this. You helped me from suffering of stress about not understanding that recurrence relation and the theorem and its proof🙏

  • @Astha_01
    @Astha_01 ปีที่แล้ว

    Highly appreciate your explanation!!

  • @RyanChristopherGuai
    @RyanChristopherGuai ปีที่แล้ว

    Thanks for the videos Sharma! You are a great teacher. Any more videos coming up?

  • @Jytx7
    @Jytx7 ปีที่แล้ว

    After two years, this still helps thanks I see that you are joyful when teaching and I appreciate you doing this.

  • @yaotingchen
    @yaotingchen ปีที่แล้ว

    thank you so much!

  • @barkobi5852
    @barkobi5852 ปีที่แล้ว

    love from Israeli programmers!

  • @jaskaransingh0304
    @jaskaransingh0304 ปีที่แล้ว

    Great explanation

  • @kevb9106
    @kevb9106 ปีที่แล้ว

    Can we choose 4 instead of 5?

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 ปีที่แล้ว

      It will be ugly -- like how we choose the median of 4 numbers? A definition like the mean of 2nd and 3nd number is problematic, since this is the comparison model (meaning u can compare elements, but you may not even get to know the "absolute" value of elements). So, one option is fix either of the 2nd or 3rd element (among 4) as the median. Then the recurrence will look like T(n) = T(n/4)+T(3n/4)+O(n), which is not O(n), but \Theta(n log n). So the answer is NO.

  • @18sp01
    @18sp01 ปีที่แล้ว

    Thank you, this video helped me fully understand!!

  • @khuyendominh4032
    @khuyendominh4032 ปีที่แล้ว

    great explanation :))

  • @KaranKumar-by7ko
    @KaranKumar-by7ko ปีที่แล้ว

    Dhanyawad guru ji

  • @shreyaspanyam2926
    @shreyaspanyam2926 ปีที่แล้ว

    Great video and great explanation too!

  • @carlavn2470
    @carlavn2470 ปีที่แล้ว

    Shouldn't the counter at 8 be 4?

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 ปีที่แล้ว

      I was counting in the other direction --- i.e.,for each number, how many are on its RIGHT side that are smaller.

    • @carlavn2470
      @carlavn2470 ปีที่แล้ว

      @@algorithmsbysharmathankach7521 right, I get that. But if we are using the R side as a counter, shouldn't the count change to 4 instead of staying as 3 at digit 8?

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 ปีที่แล้ว

      @@carlavn2470 didn't get it, can you tell me where exactly (time in the video) is the mistake?

    • @carlavn2470
      @carlavn2470 ปีที่แล้ว

      @@algorithmsbysharmathankach7521 at min 17:48

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 ปีที่แล้ว

      @@carlavn2470 yes, it is 4 (my bad) -- thankyou!

  • @reinekita
    @reinekita ปีที่แล้ว

    Much needed explanation! 👍

  • @pawanmishra4067
    @pawanmishra4067 ปีที่แล้ว

    can you pl tell the exercise number in Computational geometry book ?

  • @maisiez882
    @maisiez882 ปีที่แล้ว

    Thank you! wish i found this video before my algorithms exams...

  • @maisiez882
    @maisiez882 ปีที่แล้ว

    THANK YOU this is so clear and thorough answered all my questions on this topic with bonus induction too

  • @elirhm5926
    @elirhm5926 ปีที่แล้ว

    the best explaination ever! thank you so much!

  • @daisy_haniii
    @daisy_haniii ปีที่แล้ว

    Thank you! Great Explanation