Doubt about heap

https://ide.codingblocks.com/s/333474. what is the time and space complexity of this code