

Are all two pointers problems solvable with binary search?
source link: http://codeforces.com/blog/entry/102806
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

I've solved a lot of two pointers problems, I found that every problem I solved with two pointers is also solvable with binary search, is that true?
8 hours ago, # | Two pointers is a very generic technique, and I am sure there are problems you can solve using two pointers but not binary search. For example, Mo's algorithm is in some sense an application of two pointers, but I don't see how someone could use binary search in it. |
8 hours ago, # | It isn't true, but the answer to that question isnt really thst important. Sets for example can solve everything a priority queue can, but people still use priority queues for a lot of problems. Sometimes using binary search goes over the time limit, sometimes you would need an extra structure to use binary search, sometimes two pointers is more convinient to code. Learn both and use them when necessary (even though i would say that binary search is more important) |
Recommend
-
88
Post with 1479 views. IKEA instructions for binary search
-
68
All programmers are familiar with Linear search and Binary Search. Generally we use use them to search any element and its loc...
-
31
Introduction When probed by the Google boss on how to sort 1 million integers, former U.S. President Barack Obama, provided the correct answer. Or rathe...
-
44
Responses You have 2 free member-only stories left this month.
-
22
题目 A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than the node's key....
-
23
The most commonly used binary search variant was first published by Hermann Bottenbruch in 1962 and hasn't notably changed since. Below I'll describe several novel variants with improved performance. The most notable vari...
-
6
Modify a binary tree to get preorder traversal using right pointers onlyModify a binary tree to get preorder traversal using right pointers only02/06/2022
-
5
Why Climate Change is SolvableClimate doomism is counter-productive, scientifically inaccurate, and promotes anxiety and inaction...
-
7
[Tutorial] Greedoids: a formal way to look at families of greedily-solvable problems [Tutorial] Greedoids: a formal way to look at...
-
4
A Separable Extension Is Solvable by Radicals Iff It Is SolvableIntroductionPolynomial is of great interest in various fields, such as analysis, geometry and algebra. Given a polynomial, we try to extract as man...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK