官术网_书友最值得收藏!

Multithreaded priority queue

The elements in a queue are processed in the order that they were added to the queue; in other words, the first element that is added leaves the queue first (FIFO). Even though this abstract data structure simulates real life in many situations, depending on the application and its purposes, sometimes, we need to redefine/change the order of the elements dynamically. This is where the concept of priority queuing comes in handy.

The priority queue abstract data structure is similar to the queue (and even the aforementioned stack) data structure, but each of the elements in a priority queue, as the name suggests, has a priority associated with it; in other words, when an element is added to a priority queue, its priority needs to be specified. Unlike in regular queues, the dequeuing principle of a priority queue relies on the priority of the elements: the elements with higher priorities are processed before those with lower priorities.

The concept of a priority queue is used in a variety of different applications—namely, bandwidth management, Dijkstra's algorithm, best-first search algorithms, and so on. Each of these applications typically uses a definite scoring system/function to determine the priority of its elements. For example, in bandwidth management, prioritized traffic, such as real-time streaming, is processed with the least delay and the least likelihood of being rejected. In best-search algorithms that are used to find the shortest path between two given nodes of a graph, a priority queue is implemented to keep track of unexplored routes; the routes with shorter estimated path lengths are given higher priorities in the queue.

主站蜘蛛池模板: 安塞县| 丹棱县| 独山县| 新泰市| 上犹县| 广水市| 马山县| 乌兰县| 射阳县| 上高县| 广平县| 浪卡子县| 沙河市| 礼泉县| 开鲁县| 阳泉市| 栾川县| 日喀则市| 平阴县| 景德镇市| 项城市| 灵宝市| 蚌埠市| 玉环县| 太仆寺旗| 沛县| 漳平市| 庐江县| 漳平市| 鄯善县| 商南县| 增城市| 大庆市| 岳普湖县| 深圳市| 班戈县| 株洲市| 金沙县| 沙湾县| 板桥市| 沁水县|