Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged time-complexity
2
votes
2
answers
1471
What is the worst case time complexity of this function?
int fun(int n) { int count=0; for (int i= n; i> 0; i/=2) for(int j=0; j< i; j++) count+= 1; return count; }
int fun(int n) { int count=0; for (int i= n; i 0; i/=2) for(int j=0; j< i; j++) count+= 1; return count; }
Amar Vashishth
2.4k
views
Amar Vashishth
asked
Aug 2, 2015
Algorithms
algorithms
time-complexity
+
–
1
votes
1
answer
1472
For each function f (n) and time t in the following table, determine the largest size n of a problem that can be solved in time t , assuming that the algorithm to solve the problem takes f (n) microseconds.
please explain the method.
Hardik Vagadia
5.4k
views
Hardik Vagadia
asked
Aug 2, 2015
Algorithms
algorithms
time-complexity
+
–
0
votes
1
answer
1473
What is the smallest value of n such that an algorithm whose running time is 100n^2 runs faster than an algorithm whose running time is 2^n on the same machine?
Hardik Vagadia
3.0k
views
Hardik Vagadia
asked
Aug 2, 2015
Algorithms
algorithms
time-complexity
+
–
0
votes
2
answers
1474
A average number of comparison performed by the merge sort algorithm ,In Merging two sorted lists of length 2 is
If I have two lists of length 2 then no of comparisons in the worst case would be 2 only , since If I have say 10,20 in list A and 5,7 in list B so then on merging 10 is ...
radha gogia
11.6k
views
radha gogia
asked
Jul 31, 2015
Algorithms
algorithms
merging
time-complexity
+
–
1
votes
1
answer
1475
Given n points in the xy plane, what is the time complexity to find the closest pair?
what is the approach of this question , Is it that first we will traverse all the pairs then find the minimum distance between all the pairs
what is the approach of this question , Is it that first we will traverse all the pairs then find the minimum distance between all the pairs
radha gogia
1.1k
views
radha gogia
asked
Jul 31, 2015
Algorithms
algorithms
time-complexity
+
–
6
votes
2
answers
1476
In sorting algo which has a running time that is least dependent on initial ordering of inputs
options A. insertion B. quick C. selection D. merge
optionsA. insertionB. quickC. selectionD. merge
gate2016
6.5k
views
gate2016
asked
Jul 30, 2015
Algorithms
sorting
time-complexity
+
–
2
votes
2
answers
1477
Find Time complexity
Saraswati Walujkar
594
views
Saraswati Walujkar
asked
Jul 22, 2015
Algorithms
algorithms
time-complexity
+
–
4
votes
2
answers
1478
Time Complexity of a Custom Quick Sort Design
Given an instance of custom quick sort in which the Pivot element is always the $\left( \frac{n}{4} \right)^{th}$ ... is the time complexity of this Custom Quick Sort? A) $\mathcal{O}(n\log{}n)$ B) $\mathcal{O}(n^2)$
Given an instance of custom quick sort in which the Pivot element is always the $\left( \frac{n}{4} \right)^{th}$ smallest element. GIven a large array as input and an im...
amarVashishth
781
views
amarVashishth
asked
Jul 21, 2015
Algorithms
algorithms
time-complexity
sorting
+
–
1
votes
1
answer
1479
How many recursive calls are made by gcd function ?
I have already gone through the links of stackoverflow on this topic but still couldn't understand it clearly , so please explain the logic behind this .
I have already gone through the links of stackoverflow on this topic but still couldn't understand it clearly , so please explain the logic behind this .
radha gogia
2.2k
views
radha gogia
asked
Jul 21, 2015
Algorithms
algorithms
recursion
time-complexity
normal
+
–
0
votes
1
answer
1480
what is the tightest lower bound of the below pseudo-code ?
int isprime(int n ) { for(int i=2;i<=sqrt(n) ; i++) { if(n%i==0) { not prime } }
int isprime(int n ){for(int i=2;i<=sqrt(n) ; i++){if(n%i==0){not prime}}
radha gogia
925
views
radha gogia
asked
Jul 21, 2015
Algorithms
algorithms
time-complexity
+
–
8
votes
2
answers
1481
Given an unsorted array. The array has this property that every element in array is at most k distance from its position in sorted array where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?
(A) Insertion Sort with time complexity O(kn)(B) Heap Sort with time complexity O(nLogk)(C) Quick Sort with time complexity O(kLogk)(D) Merge Sort with time complexity O(...
radha gogia
20.2k
views
radha gogia
asked
Jul 19, 2015
Algorithms
algorithms
sorting
time-complexity
+
–
0
votes
2
answers
1482
Let s be a sorted array of n integers. Let t(n) denote the time taken for the most efficient algorithm to determined if there are two elements with sum less than 1000 in s.What will be the time complexity???????
nehab.sairam
3.3k
views
nehab.sairam
asked
Jul 18, 2015
Algorithms
algorithms
sorting
time-complexity
+
–
0
votes
1
answer
1483
Do we categorize all optimization problems in NP ?
I just want to confirm whether all optimization problems are in NP or not say to find the shortest path this can be done in polynomial time and If I am given a graph and I have to find whether there exists any path ... problem ,so is it that the optimization version of a problem is polynomial solvable and its similar decision version is NP.
I just want to confirm whether all optimization problems are in NP or not say to find the shortest path this can be done in polynomial time and If I am given a graph and ...
radha gogia
388
views
radha gogia
asked
Jul 18, 2015
Algorithms
p-np-npc-nph
shortest-path
time-complexity
+
–
0
votes
2
answers
1484
what is the use of reducing a problem for which no polynomial time algorithm exist into some another problem ?
If I have a problem A for which no polynomial time algo exists then what do we achieve by reducing it to another problemB and then proving by contradiction that if we cou...
radha gogia
695
views
radha gogia
asked
Jul 17, 2015
Algorithms
algorithms
time-complexity
+
–
0
votes
1
answer
1485
How does encoding of the problem instance affects the time complexity of the algorithm ?
If I take a problem instance in unary representation then will the algorithm take exponential time and what if the problem instance is converted into binary representation then will the time complexity remain same or will it be polynomial in time ?
If I take a problem instance in unary representation then will the algorithm take exponential time and what if the problem instance is converted into binary representatio...
radha gogia
411
views
radha gogia
asked
Jul 17, 2015
Algorithms
algorithms
time-complexity
+
–
6
votes
2
answers
1486
Assume that a CPU can process $10^8$ operations per second. Suppose you have to sort an array with $10^6$ elements. Which of the following is true?
Assume that a CPU can process $10^8$ operations per second. Suppose you have to sort an array with $10^6$ elements. Which of the following is true? 1. Insertion sort will...
radha gogia
9.0k
views
radha gogia
asked
Jul 15, 2015
Algorithms
algorithms
sorting
time-complexity
+
–
4
votes
1
answer
1487
$(\log n)!$ and $(\log \log n)!$ are polynomially bounded ? anybody can prove?
naveenagrahari
5.2k
views
naveenagrahari
asked
Jul 9, 2015
Algorithms
logarithmic-function
time-complexity
descriptive
+
–
0
votes
2
answers
1488
What is the difference between Topological sort and bellman-ford Algorithm ?
A) Do following for every vertex u in topological order. ..Do following for every adjacent vertex v of u if (dist[v] > dist[u] + weight(u, v)) dist[v] = dist[u] + weight(u, v ... following similar steps , so then why is the time complexity of bellman-ford O(VE) while for toplogical sort it is O(V+E) ?
A) Do following for every vertex u in topological order.………..Do following for every adjacent vertex v of u………………if (dist[v] dist[u] + weight(u, v))…�...
radha gogia
1.3k
views
radha gogia
asked
Jul 5, 2015
Algorithms
topological-sort
bellman-ford
time-complexity
+
–
1
votes
1
answer
1489
UGC NET CSE | Junet 2015 | Part 3 | Question: 33
Which of the following is asymptotically smaller? lg(lg*n) lg*(lgn) lg(n!) lg*(n!)
Which of the following is asymptotically smaller?lg(lg*n)lg*(lgn)lg(n!)lg*(n!)
Shubham Sahu
6.8k
views
Shubham Sahu
asked
Jul 4, 2015
Algorithms
algorithms
ugcnetcse-june2015-paper3
time-complexity
+
–
0
votes
2
answers
1490
why we use log2 n otherthan log10 n in computer science algorithums (calculating time complexities
Hai Hai
708
views
Hai Hai
asked
Jul 3, 2015
Algorithms
algorithms
time-complexity
+
–
1
votes
1
answer
1491
Time complexity of a while loop
Assuming n>2 A() { while(n>1) { n = n/2; } }
Assuming n>2 A() { while(n>1) { n = n/2; } }
thehobo03
4.9k
views
thehobo03
asked
Jun 4, 2015
Algorithms
algorithms
time-complexity
+
–
1
votes
1
answer
1492
doubt
How n + n/2 + n/4 + .... 1 can approximate it as an infinite GP? Is it =1+2+4+8+..........n/4 + n/2 +n ? =O(2^n) ?
How n + n/2 + n/4 + .... 1 can approximate it as an infinite GP?Is it =1+2+4+8+..........n/4 + n/2 +n ?=O(2^n) ?
Anu
459
views
Anu
asked
May 14, 2015
Algorithms
algorithms
asymptotic-notation
time-complexity
+
–
0
votes
1
answer
1493
doubt
Is it loglog(2^2^2^2)=4 Let n=(2^(2^(2^2)))=2^16 Loglogn=4 T(n)=1+T(2^8)=2+T(2^4)=3+T(2^2)=4+T(2)=5 Let n= (2^(2^(2^(2^(2^2)))))=2^(2^65536) Loglog n = 65536
Is it loglog(2^2^2^2)=4Let n=(2^(2^(2^2)))=2^16Loglogn=4T(n)=1+T(2^8)=2+T(2^4)=3+T(2^2)=4+T(2)=5Let n= (2^(2^(2^(2^(2^2)))))=2^(2^65536)Loglog n = 65536
Anu
788
views
Anu
asked
May 14, 2015
Algorithms
algorithms
time-complexity
+
–
1
votes
2
answers
1494
What is the time complexity ?
time complexity question Sum=0 for(i=1; i<=n;i++) { for(j=1;j<=i;j++) { if(j%i==0) { for(k=1;k<=n;k++) { sum=sum+k; } } } }
time complexity questionSum=0 for(i=1; i<=n;i++) { for(j=1;j<=i;j++) { if(j%i==0) { for(k=1;k<=n;k++) { sum=sum+k; } } } }
aayushranjan01
766
views
aayushranjan01
asked
May 14, 2015
Algorithms
algorithms
time-complexity
+
–
4
votes
3
answers
1495
Big O
The concept of order (Big O) is important because— (a) it can be used to decide the best algorithm that solves a given problem (b) it determines the maximum size of a problem that can be solved in a given system, in a given amount of time (c) it is the lower bound of the growth rate of the algorithm (d) Both (a) and (b)
The concept of order (Big O) is important because—(a) it can be used to decide the best algorithm that solves a given problem(b) it determines the maximum size of a pro...
Anu
17.6k
views
Anu
asked
May 14, 2015
Algorithms
algorithms
time-complexity
+
–
0
votes
1
answer
1496
how to calculate a,b,c,d value?
Anil Kumar Prajapati
418
views
Anil Kumar Prajapati
asked
May 13, 2015
Algorithms
algorithms
time-complexity
normal
+
–
0
votes
2
answers
1497
find the running time of the following nested loop
for(i=1;i<=n;i=i*2); for(j=1;j<=i;j=j+1); { }
for(i=1;i<=n;i=i*2);for(j=1;j<=i;j=j+1);{}
kalpashri
577
views
kalpashri
asked
May 12, 2015
Algorithms
algorithms
time-complexity
+
–
1
votes
1
answer
1498
Time complexity
In the best case, the number of comparisons needed to search a single linked list of length n for a given element is is ............ and In the best case, the number of comparisons needed to search a double linked list of length n for a given element is ................ and is it possible to apply binary search on single linked list if the elements are sorted?
In the best case, the number of comparisons needed to search a single linked list of length n for a given element is is ............and In the best case, the number of co...
supraja
863
views
supraja
asked
Apr 20, 2015
Algorithms
time-complexity
sorting
+
–
0
votes
1
answer
1499
Time com
Consider a binary tree having 'n' elements or 'n' nodes the tree is organized in such a way that at every level 'i' there are 'i' nodes assuming root to be at level 1 the height or depth of binary tree is O(......)
Consider a binary tree having 'n' elements or 'n' nodes the tree is organized in such a way that at every level 'i' there are 'i' nodes assuming root to be at level 1 the...
supraja
554
views
supraja
asked
Apr 18, 2015
DS
binary-tree
time-complexity
data-structures
+
–
0
votes
2
answers
1500
Time complexity
Consider a sorted array of 'n' elements an element in the array is said to be majority element if it is occuring more than n/2 times of the array, the time complexity of algorithm which is most efficient to determine if the array contains majority element or not is O(... )?
Consider a sorted array of 'n' elements an element in the array is said to be majority element if it is occuring more than n/2 times of the array, the time complexity of ...
supraja
342
views
supraja
asked
Apr 18, 2015
Algorithms
sorting
time-complexity
+
–
Page:
« prev
1
...
45
46
47
48
49
50
51
52
53
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register