Recent questions tagged algorithms

317
views
0 answers
2 votes
Consider the following three functions defined for all positive integers $n \geq 0$.\[\begin{array}{l}f(n)=|\sin (n)+n|, \\g(n)=n, \\h(n)=|\sin (n)| .\end{array}\] ... $\text{(i), (ii)}$, and $\text{(iii)}$ are true.
300
views
1 answers
2 votes
Consider functions $f$ and $g$ from the set of positive real numbers to itself, recursively defined as follows.\[\begin{array}{rrl}\forall n \leq 1 & f(n), g(n) & =1, \\\ ... $g(n)=\Theta(n \log n)$
350
views
1 answers
0 votes
$True$ or $False?$ If decision trees such as the ones we built in class are allowed to have decision nodes based on questions that can have many ... tend to add the multiple answer questions to the tree before adding the binary questions
453
views
1 answers
3 votes
Here is an array of ten integers$: 5389170264$Suppose we run MergeSort on this array. What is the number in the $7$th position of the partially sorted array after the outermost two ... $ in its $7$th position.)$3$1$2$4$
497
views
1 answers
2 votes
A linear-probing hash table of length $10$ uses the hash function $h(x)=x \bmod 10$ ... 46$46,34,42,23,52,33$42,46,33,23,34,52$42,23,34,52,46,33$
647
views
1 answers
8 votes
An inversion in an array $a$ is a pair of array indices $(i, j)$ such that $i<j$ but $a[i]>a[j]$.What is the maximum number of inversions that can be eliminated by the following program ... $6$9$20$
1.1k
views
2 answers
12 votes
Given an unsorted array of $n$ distinct elements, you want to find this set of $\log n$ elements: those at positions $1,2,4,8,16, \ldots, n/2$ if array were sorted. In ... \Theta(\log n)$\Theta(n)$\Theta(n \log n)$\Theta\left(n^{2}\right)$
552
views
1 answers
6 votes
Consider a directed graph $G$ with a source vertex $s, a$ destination $t$, and nonnegative edge lengths. Under what conditions is the shortest $s-t$ path ... edge lengths are distinct powers of $2.$None of the other options are correct.
223
views
1 answers
0 votes
301
views
1 answers
0 votes
The complexity of matrix multiplication of two matrices A and B whose orders are $m \times n$ and $n \times p$ respectively is$\text{O(m} \times p)$\text{O(m} \times n^2 \ ... $\text{O(m} \times n \times p)$
239
views
1 answers
0 votes
Worst case time complexity of heap sort for n elementsO(nlogn)O(logn)O^2O(n)
192
views
1 answers
0 votes
216
views
1 answers
0 votes
In the following question common lcs numbers are 4 so first 3 option should be correct or only first...there is no only written in 2,3 like only 2 or 3 so we can mark 2,3 option also?