Recent questions tagged algorithms

238
views
1 answers
0 votes
1.1k
views
2 answers
3 votes
In QuickSort algorithm, which of the following statements is NOT true regarding the partition process?a) Partition always divides the array into two non-empty subsets ... is already sorted, partitioning can be done in O(1) time complexity.
507
views
1 answers
0 votes
Consider performing QuickSort on an array of n distinct elements. What is the probability that no comparisons will be made between the smallest and largest element?a. 1/nb. 1/(n-1)c. 2/nd. 2/(n-1)Answer: d. 2/(n-1)
682
views
1 answers
1 votes
Suppose a BST is converted into an AVL tree. Which of the following statements is correct?a. The in-order traversal of the AVL tree and the BST will be the same.b. ... of the AVL tree and the BST will be the same.d. None of the above.
1.3k
views
2 answers
0 votes
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). How ... . ceil(log(n))b. floor(log(n))c. ceil(log(m))d. floor(log(m))
530
views
2 answers
1 votes
#include<stdio.h>int main(){ int x,sum; sum=0; for(x=0;x<=500;x+=10){ sum=sum+x; } printf("%d",sum); ... on computer is 12750.But i want explanation about How for loop is running and what is behaviour of sum value ?
529
views
1 answers
0 votes
675
views
1 answers
0 votes
Consider the Graph below:How many spanning trees can be found?$10$5$9$8$(Option $1 [39409]) 1$(Option $2[39410]) 2$(Option $3 [39411]) 3$(Option $4 [39412]) 4$Answer Given by Candidate : $2$
318
views
0 answers
0 votes
715
views
2 answers
0 votes
Sort the following array using quicksort algorithm. [40,11,4,72,17,2,49]
297
views
1 answers
1 votes
Let $\text{G = (V, E)}$ be a connected, undirected graph with edge weights $w: \text{E} \rightarrow \mathbb{Z}$. Suppose $\text{G}$ has a ... no cycles$\text{G}$ contains at most one cycleAll edge weights are differentNone of the above
320
views
1 answers
3 votes
Let $n$ be a positive integer.Consider the two statements below:$\text{S1:}$ If $f(n)>g(n)$ for all $n$ then $g(n)$ ... is incorrect$\text{S1}$ is incorrect but $\mathrm{S} 2$ is correctBoth are correctBoth are incorrect