laitimes

Algorithmic Life (12): From "Priority Queue Algorithm" to "Six-Point Priority Work Method"

author:Everybody is a product manager
In this article, the author introduces how the "priority queue algorithm" can be applied to our lives, let's take a look.
Algorithmic Life (12): From "Priority Queue Algorithm" to "Six-Point Priority Work Method"

Algorithm ideas are similar to many problem-solving ideas in life, let's take a look at how today's "priority queue algorithm" can be applied to our lives!

The Priority Queue Algorithm is a special data structure that adheres to the principle of "first-in, first-out" in regular queues and adds the concept of "element priority". This means that the elements in the queue are not only in the order in which they entered, but also in the order in which they are dequeued according to their respective priorities.

Elements in the queue can be of any type, as long as they can be compared to priority. Elements in the priority queue usually have a priority identifier associated with them, and the higher priority element is always at the front of the queue and is processed first. Here's how it works:

Principle:

The core principle of the priority queue is to maintain the ordering of elements by using some kind of data structure (such as heap, balanced binary search tree, etc.). Each time an element is inserted, the queue structure is adjusted according to priority, and each time an element is deleted (or accessed), the element with the highest current priority is returned and removed.

Taking a binary heap-based priority queue as an example, the basic operations include:

  1. Initialization: Creates an empty priority queue (usually an empty array or list).
  2. Insertion: When a new element is added, it is placed at the end of the array, and then the heap structure is adjusted through the "up-filtering" process to maintain the nature of the largest heap (usually the largest heap).
  3. Delete: Removes and returns the highest priority element (i.e., the top element), then moves the last element of the array to the top of the heap, and adjusts the heap structure through the "downfiltering" process to maintain the maximum heap nature.
  4. Find the highest priority element: Go directly to the top element of the heap.
  5. Check whether the queue is empty: Check the size of the heap.

Binary heap is a common implementation because the heap can insert and delete the largest (or smallest) elements in logarithmic time, and it is also relatively flexible, and can define how priorities can be compared according to specific needs, which is widely applicable to a variety of scenarios that need to consider priorities. Of course, priority queues are a bit more complex to implement than basic queues, especially when it comes to maintaining the nature of the heap.

As can be seen from the above, the complex problem is that even though the "maintenance heap" may be relatively complex, it is necessary to set the order in which the priority elements of the rule processing priority are processed. However, compared with the solution of "no focus, grasping the eyebrows and mustaches", the "priority queue algorithm" can ensure that the highest priority problem can be solved in the fastest time, and it is "the best way to do it in a limited time".

Students who are familiar with the MBA exam will have some feelings of trade-offs, the MBA exam paper may not be particularly complicated, but the exam length is a headache for everyone, the time seems to be very long, but it doesn't take long to hand in the paper!

The author specially investigated the reason for this problem, the reason is that MBA is a comprehensive ability, and it is an effective "trade-off" according to one's own situation, so as to complete the goal is also a verification criterion for the exam.

Usually you have to do the writing questions first (because it is said that the writing is not finished, and there will be no points for this item), and then do multiple-choice questions.

At the same time, in terms of mentality, you should not be affected by the fact that you have been encountering questions that cannot be answered quickly, and you must first ensure that all the questions you are proficient in are answered. "According to the current situation, keep your goals in mind and make effective trade-offs" is the only way to achieve the goal.

In life, we can apply the idea of "priority queue algorithm" in many places, for example, there are many product requirements, a sprint may not be completed, or an unexpected situation occurs, we must first ensure "one output", and it is very important to set the priority order of products. In addition, one of the biggest headaches for contemporary IT people is "work-life balance, too much overtime and no personal time", and these problems also require us to learn how to apply "priority thinking" to life.

Here is a working method that also applies "priority" thinking: the "six-point priority work system".

The "Six-Point Priority System" is an effective time management method proposed by efficiency expert Avery C. Lee, which emphasizes identifying and prioritizing the six most important tasks each day to improve productivity and output. It emphasizes focusing attention on a few of the most critical tasks rather than trying to complete a long to-do list. This approach argues that focusing on the six most important tasks each day can effectively prevent distractions from the trivial tasks of the workday and increase personal productivity. The approximate steps for this method are as follows:

  1. List tasks: At the end of each day or at the beginning of a new day, list all the tasks that need to be completed.
  2. Evaluate tasks: Each task is evaluated, taking into account factors such as urgency, importance, deadlines, etc. Usually, the consideration of importance will be higher, depending on the specific matter, depending on the individual situation.
  3. Prioritization: Pick out the six "current" most important tasks from all tasks, numbered from 1 to 6 in order of priority.
  4. Perform Tasks: Complete tasks one by one in numbered order, first task 1, then task 2, and so on until you complete six tasks. Normally, it is recommended to complete only one task at a time, because it is easier to enter the "flow" by doing only one thing at a time, and the benefits of entering the flow can not only improve the efficiency of doing things, but also allow the "scattered" heart of modern people to gradually retract, and when the mind is calm, wisdom will come out. If you really want to do two or more things at a time, the author suggests that these simultaneous things are for the individual, using different "forces", for example, some things use more physical strength (such as doing housework, walking), and some things use more listening (doing housework, listening to a learning course while walking). Here is only a general idea, you can adjust it according to the situation.
  5. Review and adjust: At the end of each day or at the beginning of the next day, review task completion, reassess and prioritize outstanding tasks.

In fact, this method is similar to the method used by the product manager to evaluate and optimize the requirements, there are so many requirements, and the requirements must always be sorted by considering the scenarios, goals, pain points, solutions, costs, etc., and after the requirements are done, they should also be adjusted and optimized according to the actual situation. Its main idea is that "energy is limited", whether it is an individual or a team is limited (plus market opportunities are waiting for no one), so it is possible for individuals or teams to find "a brush that can walk the rivers and lakes" by focusing on the most important things.

Let's take the life of a programmer as an example to expand the application ideas:

  1. Task lists: Programmers can list the various development tasks, code reviews, documentation, and more that need to be completed on a daily basis in a project management tool or paper notebook.
  2. Prioritization: Prioritize by considering factors such as how impacted the task is on the project, how close the deadline is, dependencies with other team members, and more.
  3. Focus on key tasks: Programmers should focus on the highest priority tasks first, such as fixing bugs that severely impact the user experience, completing the development of key functional modules, or technical documentation that someone else is waiting for.
  4. Time splitting: You can divide your working day into periods, each focused on completing a high-priority task.
  5. Flexibility: Programmers will inevitably encounter unexpected events (bugs) or changes in priorities (requirements changes) in their work, so they should adjust the task list and rearrange the priorities in time to ensure that they always grasp the focus of the current stage.

In the application of the "six-point priority work system", the author suggests that it is not confined to the number "6", not necessarily the six items with the highest priority, you can be the first 5 items, the first 3 items, but it is best not to exceed 6 (miscellaneous things but must be done can be classified into a point in time, unified processing), lest all the tasks become important, this number you adjust according to your own situation.

"Priority" thinking allows us to get out of the cluttered thoughts and focus on the most important and influential things, which is a bit of a "catch the thief and catch the king first". I hope this can bring some inspiration to everyone to "get out" of the work-life imbalance, if you also have a better way, welcome to share and exchange!

This article was originally published by @养心进行时 on Everyone is a Product Manager and is not allowed to be reproduced without permission

Image from Unsplash, based on the CC0 license

The views in this article only represent the author's own, everyone is a product manager, and the platform only provides information storage space services.

Job

Read on