Algorithms by Sharma Thankachan
Algorithms by Sharma Thankachan
  • Видео 18
  • Просмотров 112 282
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.
Просмотров: 925

Видео

2.8 - Probability Basics | Randomized Algorithms | Hiring Problem | Coupons Collector
Просмотров 1,8 тыс.3 года назад
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
Просмотров 2,1 тыс.4 года назад
A simple Randomized (Las Vegas) algorithm for expected linear time selection.
2.9 - Quick Sort | Randomized Algorithms (Monte Carlo vs Las Vegas)
Просмотров 2,7 тыс.4 года назад
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,4 тыс.4 года назад
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
Просмотров 13 тыс.4 года назад
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.
Просмотров 46 тыс.4 года назад
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,6 тыс.4 года назад
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,6 тыс.4 года назад
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)
Просмотров 24 тыс.4 года назад
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
Просмотров 5 тыс.4 года назад
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,7 тыс.4 года назад
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,3 тыс.4 года назад
Big-O, Big-Omega, Small-o, Small-omega, and Theta.
1.4 - Warm-up problem (Maximize your the amount of your drink + Harmonic Series)
Просмотров 8414 года назад
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)
Просмотров 1,1 тыс.4 года назад
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)
Просмотров 1,1 тыс.4 года назад
1.2 - Warm-up problem (Find the Max and the Second Max)
1.1 - Warm-up problem (Find the Min and the Max)
Просмотров 1,2 тыс.4 года назад
1.1 - Warm-up problem (Find the Min and the Max)
1.0 - Introduction
Просмотров 3,9 тыс.4 года назад
1.0 - Introduction

Комментарии

  • @SohaibHasanNiloy
    @SohaibHasanNiloy 11 дней назад

    thanks bro

  • @tashdidrahman8113
    @tashdidrahman8113 Месяц назад

    Can anyone explain why the x coordinate was not sorted ?

  • @Lack_Of_Enemies
    @Lack_Of_Enemies 2 месяца назад

    made it so clear

  • @jtrigoura1
    @jtrigoura1 3 месяца назад

    Absolutely goated explanation

  • @JeetDaiya-d6j
    @JeetDaiya-d6j 3 месяца назад

    Amazing Explaination Sir!!

  • @ARYANSINGH-hz8ly
    @ARYANSINGH-hz8ly 3 месяца назад

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

  • @sairajkarnik7362
    @sairajkarnik7362 3 месяца назад

    Congratulations! on 1k Subs

  • @xiaoyatang22
    @xiaoyatang22 4 месяца назад

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

  • @narayananishanth7357
    @narayananishanth7357 5 месяцев назад

    Excellent video 😊

  • @Mmmmmhm
    @Mmmmmhm 5 месяцев назад

    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 5 месяцев назад

      "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 5 месяцев назад

    Thank you sir, finally understood it thanks to you.

  • @radhe_krashna
    @radhe_krashna 5 месяцев назад

    why it is 7

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 5 месяцев назад

      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 5 месяцев назад

      @@algorithmsbysharmathankach7521 it should be 4 rather than 7

  • @sukhmanjitsingh2705
    @sukhmanjitsingh2705 8 месяцев назад

    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 8 месяцев назад

      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 8 месяцев назад

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

    • @sukhmanjitsingh2705
      @sukhmanjitsingh2705 8 месяцев назад

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

  • @gurmeet0108
    @gurmeet0108 8 месяцев назад

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

  • @KshitijGupta-r8p
    @KshitijGupta-r8p 8 месяцев назад

    good explanation

  • @anonymousstudent2182
    @anonymousstudent2182 9 месяцев назад

    fantastic explanation

  • @adityaband6919
    @adityaband6919 10 месяцев назад

    Amazing

  • @kelstonkkk
    @kelstonkkk 10 месяцев назад

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

  • @saichaithrik7134
    @saichaithrik7134 10 месяцев назад

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

  • @ktmi3037
    @ktmi3037 10 месяцев назад

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

  • @dmitricherleto8234
    @dmitricherleto8234 10 месяцев назад

    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 10 месяцев назад

      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 11 месяцев назад

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

  • @NairutyaPatel
    @NairutyaPatel 11 месяцев назад

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

  • @NirmalSharonJoji
    @NirmalSharonJoji 11 месяцев назад

    Thank you, Amazing video !!

  • @ZephyrrCummins
    @ZephyrrCummins 11 месяцев назад

    Very well explained !!

  • @valeriacarrillo9193
    @valeriacarrillo9193 11 месяцев назад

    thank you so much this helped a lot!!!

  • @sunilthunga5662
    @sunilthunga5662 11 месяцев назад

    Excellent Explanation!

  • @claywrentz3119
    @claywrentz3119 Год назад

    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 2 года назад

    Thank you, this video helped me fully understand!!

  • @khuyendominh4032
    @khuyendominh4032 2 года назад

    great explanation :))

  • @KaranKumar-by7ko
    @KaranKumar-by7ko 2 года назад

    Dhanyawad guru ji

  • @shreyaspanyam2926
    @shreyaspanyam2926 2 года назад

    Great video and great explanation too!

  • @carlavn2470
    @carlavn2470 2 года назад

    Shouldn't the counter at 8 be 4?

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 2 года назад

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

    • @carlavn2470
      @carlavn2470 2 года назад

      @@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 2 года назад

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

    • @carlavn2470
      @carlavn2470 2 года назад

      @@algorithmsbysharmathankach7521 at min 17:48

    • @algorithmsbysharmathankach7521
      @algorithmsbysharmathankach7521 2 года назад

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

  • @reinekita
    @reinekita 2 года назад

    Much needed explanation! 👍

  • @pawanmishra4067
    @pawanmishra4067 2 года назад

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

  • @maisiez882
    @maisiez882 2 года назад

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

  • @maisiez882
    @maisiez882 2 года назад

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