J'ai besoin de « créer une file d'attente prioritaire mis en œuvre par un arbre de recherche binaire (BST) » pour ma classe algorithmes II. Cependant, je ne sais pas exactement comment vous utiliser un arbre de recherche binaire comme une file d'attente prioritaire. Quelqu'un pourrait-il clarifier ce qu'il est que la mission me demande de faire?
À titre de référence, voici les méthodes du PriorityQueue doit mettre en œuvre:
add – adds a new item to the queue
peek – returns the head of the queue
remove – removes the head of the queue and returns it
search – returns the position of an element in the queue, or -1 if it is not found.
size – returns the total number of elements in the queue
inorder – returns an in-order, comma-separated string of every element in the queue
preorder – returns an pre-order, comma-separated string of every element in the queue
height – returns the height of the underlying BST
Nous vous remercions à l'avance pour tout conseil !!













