Am nevoie pentru a „crea o coadă de prioritate pusă în aplicare de un arbore binar de căutare (BST)“ pentru clasa mea algoritmi II. Cu toate acestea, nu sunt sigur exact cum v-ar folosi un arbore binar de căutare ca o coadă de prioritate. Ar putea cineva să clarifice ceea ce este că asignarea îmi cere să fac?
Ca referință, aici sunt metodele pe care trebuie să pună în aplicare coadă prioritară:
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
Vă mulțumim anticipat pentru orice sfat !!













