python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Time complexity for partitioning a set and sorting the partition's subsets
Suppose I have a function which partitions set S, |S|=n, into S/subsetSize subsets of size subsetSize and sorts each subset:
partitionAndSort(Set s, int subsetSize) {
List partition = partitionList...
super.t
Votes: 0
Answers: 1
How to estimate the Time Complexity of generating string Permutations using Recursion tree
The following code prints all permutations of a string:
void permutation(String str) {
permutation(str, "");
}
void permutation(String str, String prefix) {
if (str.length() == ...
Warren Crasta
Votes: 0
Answers: 2
Prim's algorithm using heap or unsorted array?
There's a question in my CS class asking that if the graph is a sparse graph, which is n^2 >> m, whether unsorted list with O(n^2) is more efficient than the binary heap O((m+n)logn). I'm a litt...
Elon Mask off
Votes: 0
Answers: 1
What is time complexity of the given code for sorting?
I thought about sorting using hash map, and the time complexity of insert operation is O(log(n)) so, I am wondering is it possible to sort using O(log(n)+n)?
//sahil L. Totala
#include <bits/stdc+...
Sahil Totala
Votes: 0
Answers: 1