Is there a algorithm to perform insertions into a heap with atmost one swap (O(log n) comparisons are allowed)
Asked
Active
Viewed 84 times
1 Answers
1
No.
Consider this heap:
Suppose you add 200. Obviously it will have to become the new root.
So where does 100 go? It can't become a child of 3, and that's what it would have to do if you only have one swap.

harold
- 61,398
- 6
- 86
- 164