Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am a mechanical student and I have changed my field to Computers. Need to get through the algorithms class. This question is one of the exercise questions
If the max heap algorithm's running time is O(klogn) then is there any algorithm which has better running time than this?
Print and remove the root k times;
O(k log n);
Yes.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
My book states that for a code with T(n) time complexity and S(n) space complexity, the following statement holds:
T(n) is omega(S(n)).
My question is: Why does this statement hold?
We are speaking of sequential algorithms.
Then space complexity S(n) means that the algorithm somehow inspects each of S(n) different memory locations at least once. In order to visit this many memory locations a sequential algorithm needs Ω(S(n)) time.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am really not able to understand how the bubble sort algorithm works. I am newbie to algorithms.
Bubble sort simply swaps two elements directly comparing them without any advanced programming technique.It works in O(n^2) time that is it will take n^2 amount of proportional time where n is number of elements.
You should have done a some amount of effort as this is available in great visualization here https://visualgo.net/bn/sorting?slide=1.
This will definitely clarify the concept.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have an unsorted array with n*n order. How to get the largest element from each row with complexity O(n logn).
You can not possibly do this. You have an input of size O(n * n) and each element of this input is a possible answer. You can not get better than O(n * n).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I read somewhere that -if some how someone someday can prove that P=NP then we cannot say that halting problem is solvable in polynomial time. Can you please explain why?
Because the halting problem is proven to be not solvable at all.
So any speed improvements obviously will not make it easier to solve
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How will you rebuild a given BST into AVL which contains exactly the same keys?
The algorithm running time should be O(n) and its allowed to use O(n) additional space. Any ideas?
The whole pseudo-code is not necessary, any idea or suggestion would be appreciated!
Thanks!
Extract all keys to sorted array (O(n) space) with suitable traversal method (O(n) time)
Build perfectly balanced tree from sorted array (O(n) time) (simultaneously filling AVL balance factors for all nodes)
I 've omitted the details for your own research