Creating 10 regions and adding them to the system: Region 19: => (((66:981168:0)30:543713:1(91:717842:0))11:445354:1(17:860958:0)) Region 14: => ((((95:205596:0)31:633661:0)10:399742:1(75:904337:0))2:208446:0) Region 25: => ((((42:378386:0)38:240297:0)18:895722:0)13:810913:1(56:852107:0)) Region 10: => (((90:980681:0)64:345157:0)35:203953:1((80:280464:0)74:940037:0)) Region 27: => (((79:631579:0)56:619532:1(71:525506:0))51:675884:1(53:922617:0)) Region 26: => (((94:703826:0)15:649839:1(88:312660:0))15:424809:1(27:845317:0)) Region 27: => (((32:574566:0)32:570071:1(91:374446:0))14:500116:1(67:444474:0)) Region 18: => ((((59:313646:0)33:805919:1(38:792061:0))29:363511:0)20:161215:0) Region 19: => (((95:885055:0)79:763642:0)24:856365:1((96:491712:0)25:861154:0)) Region 10: => (((30:953797:0)13:655834:1((90:128179:0)76:673724:0))11:304894:0) Checking the tree of regions: ((((19)18(19))10((27)14))10((26)25(27))) Get the highest priority region: Region 10: => (((90:980681:0)64:345157:0)35:203953:1((80:280464:0)74:940037:0)) Get the 3rd highest priority region: Region 18: => ((((59:313646:0)33:805919:1(38:792061:0))29:363511:0)20:161215:0) Checking the tree of regions: ((((27)19)14(27))10((26)19(25))) Changing the priority function in the highest priority region: Get the highest priority region, it must be a max heap now: Region 10: => (((40:673724:0)45:953797:1(43:128179:0))45:655834:1(40:304894:0)) Get the highest priority region, this one be a min heap: Region 14: => ((((95:205596:0)31:633661:0)10:399742:1(75:904337:0))2:208446:0)