[Note] Các thuật toán phổ biến cần phải hiểu và sử dụng
Published:
Hiểu hơn về các thuật toán phổ biến cần phải biết và sử dụng
𝟭𝟬 𝗔𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺𝘀 𝗘𝘃𝗲𝗿𝘆 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 𝗦𝗵𝗼𝘂𝗹𝗱 𝗞𝗻𝗼𝘄:
𝟬.💡 𝗕𝗿𝗲𝗮𝗱𝘁𝗵-𝗙𝗶𝗿𝘀𝘁 𝗦𝗲𝗮𝗿𝗰𝗵 (𝗕𝗙𝗦): Explore a graph level by level, starting from the root, which is great for finding the shortest path in unweighted graphs. ➡️ Useful when: You’re designing web crawlers or analyzing social networks.
𝟭.💡 𝗧𝘄𝗼 𝗛𝗲𝗮𝗽𝘀: Uses a min-heap and max-heap to manage dynamic datasets efficiently, maintaining median and priority. ➡️ Useful when: You need to manage a priority queue or dynamic datasets.
𝟮.💡 𝗧𝘄𝗼 𝗣𝗼𝗶𝗻𝘁𝗲𝗿𝘀: This technique takes 2 points in a sequence and performs logic based on the problem. ➡️ Useful when: You are implementing sorting or searching functions.
𝟯.💡 𝗦𝗹𝗶𝗱𝗶𝗻𝗴 𝗪𝗶𝗻𝗱𝗼𝘄: Optimizes the computation by reusing the state from the previous subset of data. ➡️ Useful when: You’re handling network congestion or data compression.
𝟰.💡 𝗗𝗲𝗽𝘁𝗵-𝗙𝗶𝗿𝘀𝘁 𝗦𝗲𝗮𝗿𝗰𝗵 (𝗗𝗙𝗦): Explores each path to the end, ideal for situations that involve exploring all options like in puzzles. ➡️ Useful when: You’re working with graph structures or need to generate permutations.
𝟱.💡 𝗧𝗼𝗽𝗼𝗹𝗼𝗴𝗶𝗰𝗮𝗹 𝗦𝗼𝗿𝘁: Helps in scheduling tasks based on their dependencies. ➡️ Useful when: You are determining execution order in project management or compiling algorithms.
𝟲.💡 𝗠𝗲𝗿𝗴𝗲 𝗜𝗻𝘁𝗲𝗿𝘃𝗮𝗹𝘀: Optimizes overlapping intervals to minimize the number of intervals. ➡️ Useful when: Scheduling resources or managing calendars.
𝟳.💡 𝗕𝗮𝗰𝗸𝘁𝗿𝗮𝗰𝗸𝗶𝗻𝗴: It explores all potential solutions systematically and is perfect for solving puzzles and optimization problems. ➡️ Useful when: Solving complex logical puzzles or optimizing resource allocations.
𝟴.💡 𝗧𝗿𝗶𝗲 (𝗣𝗿𝗲𝗳𝗶𝘅 𝗧𝗿𝗲𝗲): A tree-like structure that manages dynamic sets of strings efficiently, often used for searching. ➡️ Useful when: Implementing spell-checkers or autocomplete systems.
𝟵.💡 𝗙𝗹𝗼𝗼𝗱 𝗙𝗶𝗹𝗹: It fills a contiguous area for features like the ‘paint bucket’ tool. ➡️ Useful when: Working in graphics editors or game development.
𝟭𝟬.💡 𝗦𝗲𝗴𝗺𝗲𝗻𝘁 𝗧𝗿𝗲𝗲: Efficiently manages intervals or segments and is useful for storing information about intervals and querying over them. ➡️ Useful when: Dealing with database range queries or statistical calculations.
Hết.