Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage for Algorithms
Recent questions tagged algorithms
2
votes
2
answers
3031
MadeEasy Test Series: Algorithms - Greedy Algorithm
There are n white dots and n black dots. Equally spaced in a line. You want to connect each white dot with some block dot in one to one fashion with a minimum total length of wire. Consider 2 examples: Greedy algorithm gives optimal solution for Only (i) Only (ii) Both (i) and (ii) None of these
There are n white dots and n black dots. Equally spaced in a line. You want to connect each white dot with some block dot in one to one fashion with a minimum total lengt...
Prasanna
2.2k
views
Prasanna
asked
Jan 29, 2016
Algorithms
made-easy-test-series
algorithms
greedy-algorithm
+
–
17
votes
1
answer
3032
Haming Distance and Chromatic Number
Consider the undirected graph G defined as follows. The vertices are bit string of length 5. We have an edge between vertex “a” and vertex “b” iff “a” and “b” differ only in one bit possible (i.e., hamming distance1). What is the ratio of chromatic number of G to the diameter of G? Model Question : https://gateoverflow.in/3564/gate2006-it_25
Consider the undirected graph G defined as follows. The vertices are bit string of length 5. We have an edge between vertex “a” and vertex “b” iff “a” and “...
pC
2.4k
views
pC
asked
Jan 28, 2016
Graph Theory
engineering-mathematics
algorithms
graph-coloring
+
–
1
votes
1
answer
3033
If the number of records to be sorted is small, then which sorting can is efficient?
If the number of records to be sorted is small, then ...... sorting can be efficient. A. Merge B. Heap C. Insertion D. Bubble
If the number of records to be sorted is small, then ...... sorting can be efficient.A. MergeB. HeapC. InsertionD. Bubble
Purple
24.7k
views
Purple
asked
Jan 27, 2016
Algorithms
algorithms
sorting
+
–
0
votes
2
answers
3034
Internal Sorting
State True or False for internal sorting algorithms: (i) Internal sorting are applied when the entire collection if data to be sorted is small enough that the sorting can take place within main memory. (ii) The time required to read or write is considered to be significant in evaluating the ... B. (i)- True, (ii)- False C. (i)- False, (ii)- True D. (i)- False, (ii)- False
State True or False for internal sorting algorithms:(i) Internal sorting are applied when the entire collection if data to be sorted is small enough that the sorting can ...
Purple
10.8k
views
Purple
asked
Jan 27, 2016
Algorithms
algorithms
sorting
+
–
1
votes
1
answer
3035
How to solve this Recurrence ?
T(n) = $\sum_{0}^{n-1}$ T(i) + cn
T(n) = $\sum_{0}^{n-1}$ T(i) + cn
pC
397
views
pC
asked
Jan 26, 2016
Algorithms
recurrence-relation
algorithms
time-complexity
+
–
0
votes
0
answers
3036
How to remove recurrence relation when two or more are combined
What should be the approch to solve these relations? Consider the recurrence relation T(n) = T(n–1) + T(n/2) + n. Which of the following is a good tight upper bound on T(n) (A) Θ(n2) (B) Θ(n2 log n) (C) Θ(2 (log n)2) (D) Θ(n (log n)2)
What should be the approch to solve these relations?Consider the recurrence relation T(n) = T(n–1) + T(n/2) + n.Which of the following is a good tight upper bound o...
Purple
218
views
Purple
asked
Jan 26, 2016
Algorithms
algorithms
recurrence-relation
+
–
1
votes
1
answer
3037
Consider the following instance of knapsack problem with capacity W = 6.
Where did I make mistake ? plz help me :(
Where did I make mistake ? plz help me :(
worst_engineer
1.7k
views
worst_engineer
asked
Jan 25, 2016
Algorithms
algorithms
knapsack-problem
test-series
+
–
0
votes
2
answers
3038
Consider the following function f.
now , the question says , worst case time complexity. So, in the worst case , the inner loop condition is not satisfied , so , won't it be O(n2) ?
now , the question says , worst case time complexity. So, in the worst case , the inner loop condition is not satisfied , so , won't it be O(n2) ?
worst_engineer
1.5k
views
worst_engineer
asked
Jan 25, 2016
Algorithms
algorithms
time-complexity
made-easy-test-series
+
–
2
votes
1
answer
3039
Ace Test Series: Algorithms - Time Complexity
Which of the following statement is true? Binary insertion sorting (insertion sort that uses binary search to find each insertion point) requires $O (n \log n)$ total operations. In the merge-sort execution tree, roughly the same amount of work is done at ... $O(1)$ time.
Which of the following statement is true?Binary insertion sorting (insertion sort that uses binary search to find each insertion point) requires $O (n \log n)$ total oper...
Tushar Shinde
1.6k
views
Tushar Shinde
asked
Jan 24, 2016
Algorithms
ace-test-series
algorithms
time-complexity
+
–
3
votes
4
answers
3040
Ace Test Series: Algorithms - Graph Algorithms
Answer is given as (B). But, shouldn't it relax point 'c' via 'a' .. So, i guess answer should be D. Is it?
Answer is given as (B). But, shouldn't it relax point 'c' via 'a' .. So, i guess answer should be D. Is it?
Tushar Shinde
671
views
Tushar Shinde
asked
Jan 22, 2016
Algorithms
ace-test-series
algorithms
graph-algorithms
dijkstras-algorithm
+
–
2
votes
1
answer
3041
Order and run time of the algorithm?
Running time of an algorithm $T(n),$ where $n$ is input size is given by $T(n) = \begin{cases} 8 T(n/2) + qn, & \textsf{ if } n>1 \\ p, & \textsf{ if } n=1 \end{cases}$ where $p$ and $q$ are constants. $T(n)$ is $\Theta(n^2)$ $\Theta(n^n)$ $\Theta(n^3)$ $\Theta(n)$
Running time of an algorithm $T(n),$ where $n$ is input size is given by$T(n) = \begin{cases} 8 T(n/2) + qn, & \textsf{ if } n>1 \\ p, & \textsf{ if } n=1 \end{cases}$ w...
Purple
3.0k
views
Purple
asked
Jan 22, 2016
Algorithms
algorithms
recurrence-relation
+
–
0
votes
1
answer
3042
hashing Clusterng problems
Identify the false statements 1. Linear probing suffers from both primary clustering and secondary clustering. 2. Quadratic probing suffers from both primary clustering and secondary clustering. 3. Double hashing do not suffers from primary clustering but suffers from secondary clustering only to a small extent.
Identify the false statements1. Linear probing suffers from both primary clustering and secondary clustering.2. Quadratic probing suffers from both primary clustering and...
Aspi R Osa
1.4k
views
Aspi R Osa
asked
Jan 22, 2016
Algorithms
algorithms
hashing
+
–
1
votes
1
answer
3043
How to find complexity of below code ?
for (int i=3;i*i<n ;i=i+2) { while(n%i ==0 ) { printf("%d",i); n=n/i; } } In this one worst case will be when n is some prime number for which the loop will run O(sqrt(n) ) times but how to deal with the best ... even if I try forming some series like i+2i+3i+.... then what should be the last term of this series for the evaluation of while loop .
for (int i=3;i*i<n ;i=i+2) { while(n%i ==0 ) { printf("%d",i); n=n/i; } }In this one worst case will be when n is some prime number for which the loop will run O(sqrt(n) ...
radha gogia
467
views
radha gogia
asked
Jan 22, 2016
Algorithms
algorithms
time-complexity
+
–
1
votes
2
answers
3044
MadeEasy Test Series: Algorithms - Time Complexity
$T(n)=2T(\frac{n}{2})+n\log n$ for n>=2 and T(1)=0, then T(n) is (a.) $O(n)$ (b.) $O(n \log n)$ (c.) $O( n (\log n)^{2})$ (d.) $O(n^{2})$ Answer given is (c.) The solution is done using subsitution, n = $2^{k}$ But if we do with Master's theorem, then we will get option (b.) and this a case for Master's theorem, right?
$T(n)=2T(\frac{n}{2})+n\log n$ for n>=2 and T(1)=0, then T(n) is(a.) $O(n)$(b.) $O(n \log n)$(c.) $O( n (\log n)^{2})$(d.) $O(n^{2})$ Answer given is (c.) The solution is...
Utk
487
views
Utk
asked
Jan 20, 2016
Algorithms
made-easy-test-series
algorithms
time-complexity
recurrence-relation
+
–
1
votes
1
answer
3045
Heap Sort best case
What is the Best Case run time of Heap Sort ? A. $O(1)$ B. $O(n)$ C. $O(n \log n)$ D. $O(\log n)$
What is the Best Case run time of Heap Sort ?A. $O(1)$B. $O(n)$C. $O(n \log n)$D. $O(\log n)$
Himanshu1
1.3k
views
Himanshu1
asked
Jan 20, 2016
Algorithms
algorithms
sorting
binary-heap
heap-sort
+
–
1
votes
3
answers
3046
Let f(n) = Ω(n), and g(n) = O(f(n)). Then g(n) = _______ [Assume n > 0] 1. Ω(n) 2. O(n) 3. θ(n) 4. Ω(1)
Vaijenath Biradar
1.5k
views
Vaijenath Biradar
asked
Jan 19, 2016
Algorithms
asymptotic-notation
algorithms
+
–
0
votes
2
answers
3047
TestBook Test Series: Algorithms - Sorting
Akash Kanase
1.1k
views
Akash Kanase
asked
Jan 19, 2016
Algorithms
testbook-test-series
algorithms
sorting
+
–
2
votes
3
answers
3048
Ace Test Series: Algorithms - Time Complexity
Tushar Shinde
549
views
Tushar Shinde
asked
Jan 19, 2016
Algorithms
ace-test-series
algorithms
time-complexity
+
–
0
votes
1
answer
3049
Sorting array with elements in reverse order
Please explain how heapsort will give us best results?
Please explain how heapsort will give us best results?
shikharV
667
views
shikharV
asked
Jan 19, 2016
Programming in C
sorting
algorithms
time-complexity
+
–
0
votes
1
answer
3050
Algorithms: Master Method Testbook
Prasanna
441
views
Prasanna
asked
Jan 18, 2016
Algorithms
algorithms
master-theorem
recurrence-relation
testbook-test-series
+
–
0
votes
1
answer
3051
space complexity
what is the stack space required by the given function? gate(n) { if(n!=0) return gate(n-1); else printf("gate2016"); }
what is the stack space required by the given function? gate(n) { if(n!=0) return gate(n-1); else printf("gate2016"); }
Pranav Gupta 1
996
views
Pranav Gupta 1
asked
Jan 18, 2016
Algorithms
space-complexity
algorithms
+
–
0
votes
2
answers
3052
TestBook Test Series: Algorithms - Time Complexity
Tushar Shinde
343
views
Tushar Shinde
asked
Jan 18, 2016
Algorithms
testbook-test-series
algorithms
time-complexity
+
–
4
votes
1
answer
3053
Dijkstra’s algorithm
Assume priority queue in Dijkstra’s algorithm is implemented using a sorted link list and graph G (V, E) is represented using adjacency matrix. What is the time complexity of Dijkstra’s algorithm (Assume graph is connected)? How to solve this kinds of problems ? Changing DS used in one algorithm . Do I need to study the entire algorithm ?
Assume priority queue in Dijkstra’s algorithm is implemented using a sorted link list and graph G (V, E) is represented using adjacency matrix. What is the time complex...
pC
2.7k
views
pC
asked
Jan 18, 2016
Algorithms
algorithms
dijkstras-algorithm
+
–
0
votes
3
answers
3054
Let f(x), g(x) and h(x) be function which of following statement is false?
Let $f(x),g(x)$ and $h(x)$ be functions which of the following statement is false? a). if $f(x)$ is $O(g(x))$ and $g(x)$ is $O(h(x))$ then $f(x)$ is $O(h(x))$. b). if $f(x)$ ... $(b)$ I mean according to me , option (a) is correct , right ? by the rule of transitivity . Please correct me , if I am wrong.
Let $f(x),g(x)$ and $h(x)$ be functions which of the following statement is false?a). if $f(x)$ is $O(g(x))$ and $g(x)$ is $O(h(x))$ then $f(x)$ is $O(h(x))$.b). if $f...
worst_engineer
790
views
worst_engineer
asked
Jan 17, 2016
Algorithms
asymptotic-notation
algorithms
test-series
+
–
0
votes
1
answer
3055
Sorting - which will perform Better
If input is sorted in reverse order , then which sorting algorithm will perform best - A) Insertion Sort B) Merge Sort C) Heap Sort D) Quick Sort
If input is sorted in reverse order , then which sorting algorithm will perform best -A) Insertion SortB) Merge SortC) Heap SortD) Quick Sort
Himanshu1
1.8k
views
Himanshu1
asked
Jan 17, 2016
Algorithms
sorting
algorithms
normal
+
–
1
votes
2
answers
3056
Calculating time compleity of recurrence relations.
I am having some problems in calculating time complexities for recurrence relations. In one of the books, I saw two questions- 1. A(n) { if(n<=1) return (n); else { return ( A(n/2)+ A(n/2)+ n); } } The recurrence for this is given as T(n)= T(n/2)+ ... )+T(n/2) +c if n>1 I think it should be T(n)= 2T(n/2)+6T(n/2) +n^2 What am I missing here ?
I am having some problems in calculating time complexities for recurrence relations. In one of the books, I saw two questions-1.A(n){if(n<=1) return (n);else{ return ( A(...
learncp
381
views
learncp
asked
Jan 17, 2016
Algorithms
algorithms
recurrence-relation
+
–
1
votes
0
answers
3057
Question on time complexity
Given answer is B. I believe that is should be D. Please check
Given answer is B. I believe that is should be D. Please check
shikharV
1.5k
views
shikharV
asked
Jan 17, 2016
Algorithms
algorithms
time-complexity
+
–
3
votes
2
answers
3058
Recurrance Relation
an = an-1 + n , n>=1 a0=2 Find a100... ? Solution I actually wanted to know what is wrong with this method . Could you pls help Whats wrong here . T(n) = T(n-1)+n and back substitute T(n)= T(n-k) + nk putting n-k = 0 T(n) = 2+ n* n So T(100) = 2+100*100 Actual answer is 5052
an = an-1 + n , n>=1a0=2Find a100... ?SolutionI actually wanted to know what is wrong with this method .Could you pls help Whats wrong here .T(n) = T(n-1)+nand back su...
pC
497
views
pC
asked
Jan 15, 2016
Combinatory
recurrence-relation
algorithms
+
–
0
votes
0
answers
3059
TestBook Live Test 1 Q No 20
I got that Statement 3 can be false in case we have function 1/n, then its square become 1/n^2. But I don't think statement 2 is true either. Please prove whether I'm correct or wrong.
I got that Statement 3 can be false in case we have function 1/n, then its square become 1/n^2. But I don't think statement 2 is true either. Please prove whether I'm cor...
Akash Kanase
386
views
Akash Kanase
asked
Jan 15, 2016
Algorithms
test-series
testbook-test-series
algorithms
time-complexity
+
–
0
votes
2
answers
3060
Increasing Growth order
bahirNaik
2.2k
views
bahirNaik
asked
Jan 15, 2016
Algorithms
algorithms
time-complexity
test-series
+
–
Page:
« prev
1
...
97
98
99
100
101
102
103
104
105
106
107
...
118
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register