retagged by
1,738 views
0 votes
0 votes
given a degree sequence for n vertices i.e.$d_1,d_2,….d_v$.what is worst time complexity to determine if a simple graph is possible with the given degree sequence?

answer given as:$O(n^2logn)$.

according to me,for first we have to sort them which will take O(nlogn) and then we have to decrease the degrees which will take O(n) additionally ,so for first pass it will take O(nlogn) +O(n)=O(nlogn).now we have degrees which are almost sorted for which insertion sort will take O(n) to sort and additionally O(n) for decrease the degrees ,so total O(2n)=O(n).so total time = for first pass {O(nlogn)}+for n-1 pass O(n) =O($n^2$.

correct me if i m wrong.thank you
retagged by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
2
Çșȇ ʛấẗẻ asked Mar 14, 2023
423 views
Solve the following recurrences using recursion tree method and write the asymptotic time complexity T(n)=T(n/2)+n^2
0 votes
0 votes
3 answers
3
Nisha Bharti asked Sep 26, 2022
730 views
What is the time & space complexity of this algorithm?Main(){ for(i=n; i>10; i=i^1/4) { for(j=201; j<n^3; j=j+400) ...
0 votes
0 votes
1 answer
4
tusharb asked Feb 18, 2022
694 views
As we know the time complexity of solving the greedy knapsack algorithm depends mainly on the sorting algorithm used, Can we use counting sort as the sorting algorithm to...