{"id":2448,"date":"2020-11-22T04:00:10","date_gmt":"2020-11-22T04:00:10","guid":{"rendered":"https:\/\/system.camp\/?p=2448"},"modified":"2021-09-22T11:43:51","modified_gmt":"2021-09-22T11:43:51","slug":"binary-search","status":"publish","type":"post","link":"https:\/\/system.camp\/uncategorized\/binary-search\/","title":{"rendered":"Binary Search"},"content":{"rendered":"\n

Introduction:<\/strong><\/p>\n\n\n\n

Binary search is one of the most important algorithms for competitive programming. You may find other uses of binary search too, these are just a few topics mentioned that use binary search heavily:<\/p>\n\n\n\n

1. Array problems<\/em><\/p>\n\n\n\n

2. Geometry problems<\/em><\/p>\n\n\n\n

Let me give you a real-life example, imagine you walked into a room with some numbered chairs (say 1 to 1000<\/strong>). Now you come to know that you have to sit on the chair numbered 563, of course, you could find it by walking in a straight path and looking at each of the chair numbers. But for the sake of understanding binary search assume that you can jump to any chair within a fraction of time<\/strong>,<\/p>\n\n\n\n