Open rualark opened 4 years ago
B. When extracting minimal element, there is no need to find second smallest element. Just move last element of list to the beginning of the list.
Even if you want to find second smallest element, linear scan is not needed: it is either the second or the third element of the list.
B. When extracting minimal element, there is no need to find second smallest element. Just move last element of list to the beginning of the list.
Even if you want to find second smallest element, linear scan is not needed: it is either the second or the third element of the list.