![]() On the other hand, 8 is the largest number and is hence the item with the lowest priority. In this priority queue, 1 is the smallest number and is hence the item with the highest priority. The first step would be to arrange them in ascending order as follows: ![]() ![]() Let us consider a priority queue having the following priorities: The smaller the element(number), the higher the priority is applied. In an ascending order priority queue, all the elements are compared with another and the rule: the element that entered the priority queue first will be the first to be removed.Īs mentioned before, the elements in the priority queue must be comparable which means they are either less than, equal to or greater than one another.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |