filmov
tv
Search A 2D Sorted Matrix - Fundamentals of Search Space Reduction
![preview_player](https://i.ytimg.com/vi/FOa55B9Ikfg/maxresdefault.jpg)
Показать описание
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Question: There are 2 versions.
Version 1: Every row is sorted left to right in non-decreasing order. The first integer of each row is greater or equal to the last integer of the previous row.
Version 2: Every row is sorted left to right in non-decreasing order. Every column is sorted top to bottom in non-decreasing order. There are no guarantees that the first item of any row or column relates to the last item in the previous row or column.
Sorted. Binary search is very likely. Investigate, how do we reduce our decision space?
Our first answer does not need to be logarithmic (it is so crucial you understand logarithms and what they mean....you need to know your complexities to refine answers and notice avenues to better solutions).
The key to search problems is that you notice the fundamental decision we can make to reduce the problem.
...more notes I wrote...
++++++++++++++++++++++++++++++++++++++++++++++++++
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Question: There are 2 versions.
Version 1: Every row is sorted left to right in non-decreasing order. The first integer of each row is greater or equal to the last integer of the previous row.
Version 2: Every row is sorted left to right in non-decreasing order. Every column is sorted top to bottom in non-decreasing order. There are no guarantees that the first item of any row or column relates to the last item in the previous row or column.
Sorted. Binary search is very likely. Investigate, how do we reduce our decision space?
Our first answer does not need to be logarithmic (it is so crucial you understand logarithms and what they mean....you need to know your complexities to refine answers and notice avenues to better solutions).
The key to search problems is that you notice the fundamental decision we can make to reduce the problem.
...more notes I wrote...
++++++++++++++++++++++++++++++++++++++++++++++++++
Комментарии