Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • This is quite unclear - you haven't shown us any code, so we don't really know what you're measuring/comparing. (Note also stackoverflow.com/questions/504103/…). Commented Apr 15, 2017 at 18:44
  • (1) You'll need to show us a complete (and short) program. (2) An unbalanced BST is inefficient, that's why you balance it. No, it is not "expected to be balanced if created by add() only". The sort will take O(n^2). (3) The binary heap taking long could very well be related to an inefficiency in your implementation. (4) Do try to stick to one question. (5) Keep it short and to the point, including all the backstory will make people skip or downvote the question. The first way isn't even included in any question so there's no reason to include it and have it take up our reading time. Commented Apr 15, 2017 at 19:02
  • If you don't post your code, we don't even know whether you have faithfully reproduced the algorithms that you are allegedly comparing. Commented Apr 15, 2017 at 19:36
  • Also, it's going to depend on the size of the input and how you're generating it. Saying it took 50 times longer doesn't really mean much without context. Commented Apr 15, 2017 at 19:41
  • For what value/s of n have you tested? That is, how long an array? Commented Apr 15, 2017 at 20:03