Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged time-complexity
0
votes
1
answer
601
Dynamic programming
Given a sequence of n real numbers a1,a2,a3...an then to find contiguous subsequence ai,ai+1,ai+2....aj. Such that it's sum is maximum. How much time the above problem will take if you use dynamic programming?
Given a sequence of n real numbers a1,a2,a3...an then to find contiguous subsequence ai,ai+1,ai+2....aj. Such that it's sum is maximum. How much time the above problem wi...
shipra tressa
1.5k
views
shipra tressa
asked
Jul 17, 2018
Algorithms
dynamic-programming
time-complexity
+
–
0
votes
1
answer
602
Masters theorem
Solve by using master's theorem
Solve by using master's theorem
bts
570
views
bts
asked
Jul 17, 2018
Algorithms
time-complexity
master-theorem
algorithms
asymptotic-notation
recurrence-relation
+
–
0
votes
2
answers
603
Time complexity
Find the time complexity using Master's theorem : (Also mention if Master's theorem can't be applied why not?) T(n)=2T(n/2)+nlogn
Find the time complexity using Master's theorem : (Also mention if Master's theorem can't be applied why not?)T(n)=2T(n/2)+nlogn
Soham.SR
810
views
Soham.SR
asked
Jul 16, 2018
Algorithms
time-complexity
master-theorem
+
–
0
votes
3
answers
604
Masters theorem
Solve using Master's Theorem $T(n)=T(n/2)+$ 2n
Solve using Master's Theorem$T(n)=T(n/2)+$ 2n
Vishnathan
848
views
Vishnathan
asked
Jul 16, 2018
Algorithms
master-theorem
algorithms
time-complexity
+
–
1
votes
0
answers
605
Time Complexity
Consider the following C code: int f(int x){ if(x<1) return 1; else return f(x-1)+g(x); } int g(int x){ if(x<2) return 1; else return f(x-1)+g(x/2); } Of the following, which best describes the growth of f(x) as a function of x? a) logarithmic b) quadratic c) linear d) exponential please explain.
Consider the following C code:int f(int x){if(x<1) return 1;else return f(x-1)+g(x);}int g(int x){if(x<2) return 1;else return f(x-1)+g(x/2);}Of the following, which best...
nishant279
399
views
nishant279
asked
Jul 14, 2018
Algorithms
time-complexity
algorithms
+
–
1
votes
0
answers
606
Algorithms-Time Complexity
What is the time complexity of the below code? for($k=n^{10};k \geq 5;k=k^{\frac{1}{7}},k=k^2$) { $k=k^5;$ $k=k-10$ } My answer comes to be $O(log_{\frac{7}{10}}log_5(n^{10}))$ Please verify.
What is the time complexity of the below code?for($k=n^{10};k \geq 5;k=k^{\frac{1}{7}},k=k^2$){ $k=k^5;$ $k=k-10$}My answer comes to be $O(log_{\frac{7}{10}}log_5(n^{...
Ayush Upadhyaya
723
views
Ayush Upadhyaya
asked
Jul 14, 2018
Algorithms
time-complexity
algorithms
asymptotic-notation
+
–
1
votes
1
answer
607
TIme complexity
Q.14 What is the time complexity of the following recursive function? int Dosomething (int n) { if(n≤2) return 1; else return (Dosomething (floor(sqrt(n))) + n); (a) Ѳ(n 2 ) (c) Ѳ(log 2 n) (b) Ѳ(nlog 2 n) (d) Ѳ(log 2 log 2 n)
Q.14 What is the time complexity of the following recursive function?int Dosomething (int n) {if(n≤2)return 1;elsereturn (Dosomething (floor(sqrt(n))) + n);(a) Ѳ(n 2 )...
pradeepchaudhary
1.4k
views
pradeepchaudhary
asked
Jul 14, 2018
Algorithms
time-complexity
algorithms
+
–
2
votes
2
answers
608
Time Complexity Of the Algorithm
Q.6 The time complexity of an algorithm T(n), where n is the input size, is given by— T(n)= T(n-1) + 1/n, if n>1 = 1, otherwise. The order of the algorithm is— (a) log n (c) n^2 (b) n (d) n*n
Q.6 The time complexity of an algorithm T(n), where n is the input size, is given by— T(n)= T(n-1) + 1/n, if n>1 = 1, otherwise.The order of the algorithm is�...
pradeepchaudhary
9.2k
views
pradeepchaudhary
asked
Jul 14, 2018
Algorithms
algorithms
time-complexity
recurrence-relation
+
–
0
votes
4
answers
609
UGC NET CSE | July 2018 | Part 2 | Question: 21
The solution of the recurrence relation $T(m) = T(3m/4)+1$ is $\Theta (\lg \: m)$ $\Theta (m)$ $\Theta (m\lg m)$ $\Theta (\lg\lg m)$
The solution of the recurrence relation $T(m) = T(3m/4)+1$ is$\Theta (\lg \: m)$$\Theta (m)$$\Theta (m\lg m)$$\Theta (\lg\lg m)$
Pooja Khatri
2.2k
views
Pooja Khatri
asked
Jul 13, 2018
Algorithms
ugcnetcse-july2018-paper2
algorithms
time-complexity
recurrence-relation
+
–
1
votes
1
answer
610
Time Complexity for Log rquestions
void fun() { int i, j; for (i=1; i<=n; i++) for (j=1; j<=log(i); j++) printf("GeeksforGeeks"); } Soln--> thetha(nlogn) Anyone please explain me in detail how to solve log series problems and what are the prerequisites to solve log problems.As i get Stuck in log problems.Please Help! Thanks
void fun() { int i, j; for (i=1; i<=n; i++) for (j=1; j<=log(i); j++) printf("GeeksforGeeks"); }Soln thetha(nlogn) Anyone please explain me in detail how to solve log se...
Mayankprakash
1.5k
views
Mayankprakash
asked
Jul 13, 2018
Algorithms
time-complexity
algorithms
+
–
0
votes
3
answers
611
Made easy workbook
Priyanka Agarwal
1.1k
views
Priyanka Agarwal
asked
Jul 11, 2018
Algorithms
made-easy-booklet
time-complexity
+
–
0
votes
0
answers
612
How to evaluate time complexity for below question ?
radha gogia
477
views
radha gogia
asked
Jul 11, 2018
Algorithms
algorithms
time-complexity
+
–
0
votes
1
answer
613
#Self Doubt #programming-in-c What will be time complexity of the program?
What will be time complexity of the program? Explain?? #include<stdio.h> int main(){ int i,count=0; for(i=1 ; i<=n ; i++) { for(i=1 ; i<=$n^4$ ; i++) for(i=1 ; i<=$n^3$ ; i++){ count++; printf("%d\n",count); } } }
What will be time complexity of the program? Explain??#include<stdio.h>int main(){ int i,count=0; for(i=1 ; i<=n ; i++) { for(i=1 ; i<=$n^4$ ; i++) ...
sumitr
446
views
sumitr
asked
Jul 10, 2018
Programming in C
programming-in-c
time-complexity
+
–
4
votes
0
answers
614
time complexity
for(int i=0; i < n; i++) { for(int j=0; j < (2*i); j+=(i/2)) { cout<<"Hello Geeks"; } } is it o(nlogn)??
for(int i=0; i < n; i++) { for(int j=0; j < (2*i); j+=(i/2)) { cout<<"Hello Geeks"; } }is it o(nlogn)??
vijju532
1.5k
views
vijju532
asked
Jul 10, 2018
Algorithms
time-complexity
algorithms
asymptotic-notation
+
–
4
votes
7
answers
615
Searching
Q) Consider a sorted array of n numbers. What would be the time complexity of the best known algorithm to find a pair a and b such that |a-b| = k , k being a positive integer. a) O(logn) b) O(n) c)O(nlogn) d)O(n^2) Which of the option is Correct And Why?
Q) Consider a sorted array of n numbers. What would be the time complexity of the best known algorithm to find a pair a and b such that |a-b| = k , k being a positive int...
pradeepchaudhary
12.7k
views
pradeepchaudhary
asked
Jul 9, 2018
Algorithms
algorithms
sorting
time-complexity
binary-search
+
–
0
votes
1
answer
616
Sorting:
You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate? 1)QuickSort 2)MergeSort 3)HeapSort 4)Selection Sort Explain? How
You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate?1)QuickSort2)MergeSort3)HeapSort4)Selection Sort...
pradeepchaudhary
3.3k
views
pradeepchaudhary
asked
Jul 8, 2018
Algorithms
sorting
algorithms
time-complexity
heap-sort
+
–
0
votes
2
answers
617
Time complexity
To construct binary search tree either from preorder or postorder what is the efficient time complexity ? can we construct unique BST along with post and preorder ?Then what is the significance of using PRE+INORDER or POST+INORDER
To construct binary search tree either from preorder or postorder what is the efficient time complexity ?can we construct unique BST along with post and preorder ?Then wh...
once_2019
601
views
once_2019
asked
Jul 8, 2018
Programming in C
time-complexity
+
–
0
votes
2
answers
618
what is the time complexity of below code ?
foo(int n) { for(int i=0 ; i<n ;i++) for(int j=i ; j<=i*i ;j++) if(j%i==0) { for(int k=0;k<j;k++) printf("hii"); } } How to proceed here for analyzing the time complexity ?
foo(int n) { for(int i=0 ; i<n ;i++) for(int j=i ; j<=i*i ;j++) if(j%i==0) { for(int k=0;k<j;k++) printf("hii"); } } How to proceed here for analyzing the time complexity...
radha gogia
1.6k
views
radha gogia
asked
Jul 7, 2018
Algorithms
algorithms
time-complexity
+
–
0
votes
1
answer
619
#algorithm
15.4-1 is it right ??? ans is 6 ?? is there any other method to determine the lcs coz it requires time to compute till the whole traversal of matrix
15.4-1 is it right ???ans is 6 ??is there any other method to determine the lcs coz it requires time to compute till the whole traversal of matrix
vijju532
336
views
vijju532
asked
Jul 7, 2018
Algorithms
algorithms
time-complexity
+
–
2
votes
1
answer
620
Time Complexity
Given a 0-indexed array A of integers of size N >= 3 where every element is one more or one less than the previous element. If there is exactly one element, A[i] where 0 < i < N-1, which is either greater or less than both its adjacent elements, which of the following is ... in the array? Pick one of the choices a) O(1) b) O(n) c) O(logn) d) O(sqrt(n)) e) None of the above
Given a 0-indexed array A of integers of size N >= 3 where every element is one more or one less than the previous element. If there is exactly one element, A[i] where 0 ...
Naveen Kumar 3
681
views
Naveen Kumar 3
asked
Jul 5, 2018
Algorithms
time-complexity
algorithms
+
–
1
votes
1
answer
621
Asymptotic time complexity to add a node at the end of singly linked list.
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list? (a) O(1) (b) O(n) (c) θ (n) (d) θ (1) Confused between option (b) and (c) .
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?(a) O(1) (b...
arya_stark
21.1k
views
arya_stark
asked
Jul 4, 2018
DS
data-structures
linked-list
time-complexity
+
–
0
votes
1
answer
622
self doubt
what is the time complexity to construct binary search tree when preorder and postorder of tree given? answer given is O(n) but i think it will be nlogn...becz from given postorder or preorder we need to find in order by sortingin nlogn tum so I think overalltime complexity will be nlogn ..???
what is the time complexity to construct binary search tree when preorder and postorder of tree given?answer given is O(n)but i think it will be nlogn...becz from given p...
eyeamgj
809
views
eyeamgj
asked
Jul 3, 2018
DS
data-structures
binary-search-tree
time-complexity
+
–
0
votes
1
answer
623
self doubt
all NP problems have the complexity exponential ???
all NP problems have the complexity exponential ???
vijju532
227
views
vijju532
asked
Jul 2, 2018
Algorithms
algorithms
p-np-npc-nph
time-complexity
+
–
0
votes
0
answers
624
Recurrence Equation
To prove that the time complexity of equation T(n) = T(α n) + T((1 – α)n) + βn is Θ(n logn).
To prove that the time complexity of equationT(n) = T(α n) + T((1 – α)n) + βnisΘ(n logn).
pk14697
334
views
pk14697
asked
Jul 2, 2018
Algorithms
time-complexity
algorithms
recurrence-relation
+
–
0
votes
2
answers
625
Complexity!!!
Hello anyone can help me to find big O for this algorithm please.... f=1; x=3; for (int i = 1; i <= n; i*=2) for (int j = 1; j <= i * i; j++) if (i % j == 0) for (int k = 1; k <= j; k++) f=f*x;
Hello anyone can help me to find big O for this algorithm please.... f=1;x=3;for (int i = 1; i <= n; i*=2) for (int j = 1; j <= i * i; j++) if (i % j == 0) ...
sweet heart
305
views
sweet heart
asked
Jul 1, 2018
Algorithms
algorithms
time-complexity
+
–
3
votes
2
answers
626
Quick Sort Time Complexity
Quick sort gives O(nlogn) worst case performance if the pivot is selected as: a) First element of the array b) Median of first, last and middle elements c) Arithmetic mean of the elements d) None of these Now, the answer is given as Option (b). But, ... order of elements and not on pivot element. So, answer should be option (d) i.e None of these Correct me if I am wrong
Quick sort gives O(nlogn) worst case performance if the pivot is selected as:a) First element of the arrayb) Median of first, last and middle elementsc) Arithmetic mean o...
garvit_vijai
3.4k
views
garvit_vijai
asked
Jul 1, 2018
Algorithms
quick-sort
sorting
time-complexity
+
–
2
votes
1
answer
627
Time Complexity in
What is the time Complexity of 2T(n/2) + nlogn? Can we apply Master's Theorem?
What is the time Complexity of 2T(n/2) + nlogn? Can we apply Master's Theorem?
nishant279
2.2k
views
nishant279
asked
Jul 1, 2018
Algorithms
time-complexity
algorithms
recurrence-relation
+
–
0
votes
1
answer
628
time complexity
what is the time complexity of the following program? int unknown(int n) { int i,j,k=0; for(i=n/2;i<=n;i++) for(j=2;j<=n;j=j*2) k=k+n/2; return (k); } Please explain briefly.
what is the time complexity of the following program? int unknown(int n) { int i,j,k=0; for(i=n/2;i<=n;i++) for(j=2;j<=n;j=j*2) k=k+n/2; return (k); }Please explain brief...
Siddharth Bhardawaj
702
views
Siddharth Bhardawaj
asked
Jul 1, 2018
Algorithms
time-complexity
+
–
3
votes
2
answers
629
Merge Sort
The average no. of comparisons performed by the merge sort algorithm, in merging two sorted lists of length 2 is - a) 8/3 b) 8/5 c) 11/7 d) 11/6
The average no. of comparisons performed by the merge sort algorithm, in merging two sorted lists of length 2 is -a) 8/3b) 8/5c) 11/7d) 11/6
garvit_vijai
18.0k
views
garvit_vijai
asked
Jul 1, 2018
Algorithms
merge-sort
merging
time-complexity
+
–
0
votes
1
answer
630
time complexity
What is the time complexity of the following program? main() { i = n; while(i>=1) { i=i/2; i=i/3; i=i/5; i=i*10; i=i-10; } } I am getting actual answer as $\log _3n$+ n/10 = O(n). Please explain briefly.
What is the time complexity of the following program?main(){ i = n;while(i>=1) { i=i/2; i=i/3; i=i/5; i=i*10; i=i-10;}}I am getting actual ...
Siddharth Bhardawaj
443
views
Siddharth Bhardawaj
asked
Jul 1, 2018
Algorithms
time-complexity
+
–
Page:
« prev
1
...
16
17
18
19
20
21
22
23
24
25
26
...
53
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register