11. Sparse Grids & Hash Map Traversal | BFS (Codeforces King's Path)
Continuing Phase 3: Implicit Graphs. In this lecture, we tackle Codeforces "King's Path" and confront the Memory Limit Exceeded (MLE) trap. When a problem features a grid size of 10^9 X 10^9, allocating a standard 2D array is mathematically impossible. We bypass this entirely by constructing a sparse grid. By utilizing std::map (or std::unordered_map), we track only the explicitly allowed segments, dynamically building our graph structure in memory only as we traverse it. This is a crucial technique for navigating infinite or hyper-massive state spaces. π Problem Link: https://codeforces.com/contest/242/problem/C π πππ₯ππ¨π¦π ππ¨ ππ‘π ππ‘ππ§π§ππ₯!β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£ β£β£β£β£β£β£ I create content on Competitive Programming, Data Structures & Algorithms (DSA), and now Software Development with Go. If you find this video helpful, donβt forget to: π Like the video π¬ Comment your doubts/questions (I reply to everyone!) π Subscribe and turn on notifications to never miss upcoming tutorials β£β£β£β£β£β£ π ππ¨π§π§πππ π°π’ππ‘ π¦π:β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£β£ β£β£β£β£β£β£ π¦ X: https://x.com/Yash_Poonia_ πΌ LinkedIn: https://www.linkedin.com/in/yashpoonia/ π» GitHub: https://github.com/yash7xm/ π Discord: https://discord.gg/dAp2PbKFpV #BFS #CompetitiveProgramming #GraphTheory #Codeforces #Algorithms #Cplusplus #SoftwareEngineering
Download
0 formatsNo download links available.