Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged algorithm-design
2
votes
0
answers
61
ISI2011-PCB-A-4b
Consider the following intervals on the real line: $A_1 = (13.3, 18.3) \: A_3 = (8.3, 23.3) − A_1 \cup A_2$ $A_2 = (10.8, 20.8) − A_1 \: A_4 = (5.8, 25.8) − A_1 \cup A_2 \cup A_3$ where $(a, b) = \{x : a < x < b\}$. Write pseudo-code that ... given input $x \in (5.8, 25.8)$ belongs to, i.e., your pseudo-code should calculate $i \in \{1, 2, 3, 4\}$ such that $x \in A_i$.
Consider the following intervals on the real line: $A_1 = (13.3, 18.3) \: A_3 = (8.3, 23.3) − A_1 \cup A_2$ $A_2 = (10.8, 20.8) − A_1 \: A_4 = (5.8, 25.8) − A_1 \cu...
go_editor
438
views
go_editor
asked
Jun 3, 2016
Algorithms
descriptive
isi2011
algorithms
algorithm-design
+
–
1
votes
1
answer
62
ISI2012-PCB-A-3
Given an array $A = \{a_1, a_2, \dots, a_n\}$ of unsorted distinct integers, write a program in pseudo-code for the following problem: given an integer $u$, arrange the elements of the array $A$ such that all the elements in A which are less than or equal to ... which are greater than $u$ are at the end of the array. You may use at most 5 extra variables apart from the array $A$.
Given an array $A = \{a_1, a_2, \dots, a_n\}$ of unsorted distinct integers, write a program in pseudo-code for the following problem: given an integer $u$, arrange the e...
go_editor
489
views
go_editor
asked
Jun 2, 2016
Algorithms
descriptive
isi2012
algorithms
algorithm-design
+
–
1
votes
0
answers
63
ISI2013-PCB-CS-7
A connected, simple, undirected planar graph $G(V, E)$ is given where $V$ denotes the set of vertices and E denotes the set of edges. In $V$, there is a designated source vertex $s$ and a designated destination vertex $t$. Let $P(v)$ ... .]
A connected, simple, undirected planar graph $G(V, E)$ is given where $V$ denotes the set of vertices and E denotes the set of edges. In $V$, there is a designated source...
go_editor
512
views
go_editor
asked
Jun 1, 2016
Algorithms
descriptive
isi2013-pcb-cs
algorithms
graph-theory
algorithm-design
+
–
1
votes
0
answers
64
ISI2013-PCB-CS-3
Let $M$ be an $(n \times n)$ matrix where each element is a distinct positive integer. Construct another matrix $M'$ by permuting the rows and/or permuting the columns, such that the elements of one row appear in increasing order ... structure that supports your algorithm. Clearly explain how much additional storage, other than the matrix itself, is required in your algorithm.
Let $M$ be an $(n \times n)$ matrix where each element is a distinct positive integer. Construct another matrix $M'$ by permuting the rows and/or permuting the columns, s...
go_editor
484
views
go_editor
asked
Jun 1, 2016
Algorithms
descriptive
isi2013-pcb-cs
algorithms
algorithm-design
+
–
2
votes
0
answers
65
ISI2013-PCB-CS-2a
Draw a complete binary tree $T$ with $(N − 1)$ nodes where $N = 2^n$. Suppose each node in $T$ is a processor and each edge of $T$ is a physical link between two processors through which they can communicate. Given $M$ ... architecture to compute the sum of each array $SUM_i = \Sigma^N_{j=1} e_{ji}$ for all $i$ in $O(\log N + M)$ time.
Draw a complete binary tree $T$ with $(N − 1)$ nodes where $N = 2^n$. Suppose each node in $T$ is a processor and each edge of $T$ is a physical link between two proces...
go_editor
463
views
go_editor
asked
Jun 1, 2016
Algorithms
descriptive
isi2013-pcb-cs
algorithms
algorithm-design
+
–
1
votes
0
answers
66
ISI2013-PCB-CS-1a,b
Consider the $fast \: square$ and $multiply \: algorithm$ to calculate $x^y \: mod \: N$ as given below, where $x, \: y,\: N$ are positive integers and $1 \leq x, y < N$. Input: $x, \:y, \:N$ ... , all of which are of type $unsigned long long$ (i.e., 64-bit unsigned integers). Discuss whether your program works perfectly for all possible input combinations.
Consider the $fast \: square$ and $multiply \: algorithm$ to calculate $x^y \: mod \: N$ as given below, where $x, \: y,\: N$ are positive integers and $1 \leq x, y < N$....
go_editor
326
views
go_editor
asked
May 31, 2016
Algorithms
descriptive
isi2013-pcb-cs
algorithms
algorithm-design
+
–
1
votes
1
answer
67
ISI2014-PCB-CS-3a
Let $A$ and $B$ be two arrays, each containing $n$ distinct integers. Each of them is sorted in increasing order. Let $C = A \cup B$. Design an algorithm for computing the median of $C$ as efficiently as you can.
Let $A$ and $B$ be two arrays, each containing $n$ distinct integers. Each of them is sorted in increasing order. Let $C = A \cup B$. Design an algorithm for computing t...
go_editor
711
views
go_editor
asked
May 31, 2016
Algorithms
isi2014-pcb-cs
algorithms
algorithm-design
+
–
1
votes
1
answer
68
ISI2014-PCB-CS-1
Assume you have a chocolate bar containing a number of small identical squares arranged in a rectangular pattern. Our job is to split the bar into small squares by breaking along the lines between the squares. We obviously want to do it with the minimum ... m as inputs and print the line numbers along the length and the breadth according to your strategy of breaking the chocolate.
Assume you have a chocolate bar containing a number of small identical squares arranged in a rectangular pattern. Our job is to split the bar into small squares by breaki...
go_editor
585
views
go_editor
asked
May 31, 2016
Algorithms
isi2014-pcb-cs
descriptive
algorithms
algorithm-design
+
–
11
votes
4
answers
69
ISI2015-PCB-CS-2a
You are given two strings $S$ and $T$, each of length $\alpha$, consisting only of lower case English letters $(a,b, \dots ,z)$. Propose an $O(\alpha)$-time algorithm to decide whether $S$ can be obtained by permuting the symbols of $T$ ... $\text{YES}$; but if $S \: = \text{ trainee}$, $T\: = \text{ retinaa}$, your algorithm should return $\text{NO}$.
You are given two strings $S$ and $T$, each of length $\alpha$, consisting only of lower case English letters $(a,b, \dots ,z)$. Propose an $O(\alpha)$-time algorithm to ...
go_editor
1.0k
views
go_editor
asked
May 29, 2016
Algorithms
descriptive
isi2015-pcb-cs
algorithms
algorithm-design
+
–
2
votes
1
answer
70
ISI2015-PCB-A-1
Given an array $A$ of n positive integers, write a program segment / pseudo-code to print the histogram of $A$ using the hash character ($\#$). Your histogram should consist of $n$ vertical columns of $\#$ with the $i$-th vertical bar containing $A[i]$ number of $\#$'s. For example, ...
Given an array $A$ of n positive integers, write a program segment / pseudo-code to print the histogram of $A$ using the hash character ($\#$). Your histogram should cons...
go_editor
528
views
go_editor
asked
May 29, 2016
Algorithms
isi2015-pcb-a
descriptive
algorithms
algorithm-design
+
–
12
votes
4
answers
71
CMI2012-B-03b
Let $A$ be an array of $n$ integers, sorted so that $A[1] \leq A[2] \leq \dots A[n]$. Suppose you are given a number $x$ and you wish to find out if there exist indices $k$ and $l$ such that $A[k]+A[l] = x$. Design an $O(n)$ algorithm for this problem.
Let $A$ be an array of $n$ integers, sorted so that $A \leq A \leq \dots A[n]$. Suppose you are given a number $x$ and you wish to find out if there exist indices $k$ a...
go_editor
1.4k
views
go_editor
asked
May 27, 2016
Algorithms
descriptive
cmi2012
algorithms
algorithm-design
+
–
1
votes
2
answers
72
CMI2010-B-01b
An international cellphone company provides service on 7 different frequencies. They wish to set up business in Tamil Nadu and have fixed the locations of 100 towers for their new service. The company has to ensure that two towers broadcasting on the same ... should say feasible if it is feasible, otherwise output the minimum number of frequencies needed to utilise all 100 towers.
An international cellphone company provides service on 7 different frequencies. They wish to set up business in Tamil Nadu and have fixed the locations of 100 towers for ...
go_editor
638
views
go_editor
asked
May 27, 2016
Algorithms
cmi2010
descriptive
algorithms
algorithm-design
+
–
2
votes
1
answer
73
CMI2015-B-05
An airline runs flights between several cities of the world. Every flight connects two cities. A millionaire wants to travel from Chennai to Timbuktu by changing at most $k_1$ flights. Being a millionaire with plenty of time and money, he does not mind revisiting ... flights at most $k_1$ times. You can assume that the procedure can add or multiply two numbers in a single operation.
An airline runs flights between several cities of the world. Every flight connects two cities. A millionaire wants to travel from Chennai to Timbuktu by changing at most ...
go_editor
512
views
go_editor
asked
May 27, 2016
Algorithms
cmi2015
descriptive
algorithms
algorithm-design
+
–
2
votes
2
answers
74
CMI2014-B-06b
Let $A$ be array of $n$ integers that is not assumed to be sorted. You are given a number $x$. The aim is to find out if there are indices $k,\: l$ and $m$ such that $A[k] + A[l] + A[m] = x$. Design an algorithm for this problem that works in time $O(n^2)$.
Let $A$ be array of $n$ integers that is not assumed to be sorted. You are given a number $x$. The aim is to find out if there are indices $k,\: l$ and $m$ such that $A[...
go_editor
428
views
go_editor
asked
May 27, 2016
Algorithms
cmi2014
descriptive
algorithms
algorithm-design
+
–
2
votes
1
answer
75
CMI2014-B-06a
Let $A$ be an array of $n$ integers, sorted so that $A[1] \leq A[2] \leq \dots \leq A[n]$. You are given a number $x$x. The aim is to find out if there are indices $k$ and $l$ such that $A[k] + A[l] = x$. Design an algorithm for this problem that works in time $O(n)$.
Let $A$ be an array of $n$ integers, sorted so that $A \leq A \leq \dots \leq A[n]$. You are given a number $x$x. The aim is to find out if there are indices $k$ and $l...
go_editor
417
views
go_editor
asked
May 27, 2016
Algorithms
cmi2014
descriptive
algorithms
algorithm-design
+
–
1
votes
2
answers
76
CMI2014-B-04
The frequency of a number in an array is the number of times it appears in the array. Describe an algorithm that finds the most frequent number in an array of $n$ numbers. If there are multiple numbers with highest frequency then list them all. Analyze the complexity of your algorithm.
The frequency of a number in an array is the number of times it appears in the array. Describe an algorithm that finds the most frequent number in an array of $n$ numbers...
go_editor
444
views
go_editor
asked
May 27, 2016
Algorithms
cmi2014
descriptive
algorithms
algorithm-design
+
–
1
votes
1
answer
77
CMI2014-B-03
$\text{Air CMI }$operates direct flights between different cities. For any pair of cities $A$ and $B$, there is at most one flight in a day from $A$ to $B$. The online site $FakeTrip$ is tryingto compile a list of all routes available ... list all pairs of cities connected by a route on which all connections are feasible within the same day. Analyze the complexity of your algorithm.
$\text{Air CMI }$operates direct flights between different cities. For any pair of cities $A$ and $B$, there is at most one flight in a day from $A$ to $B$. The online si...
go_editor
465
views
go_editor
asked
May 27, 2016
Algorithms
cmi2014
descriptive
algorithms
algorithm-design
+
–
1
votes
2
answers
78
CMI2013-B-06a
Your final exams are over and you are catching up on watching sports on TV. You have a schedule of interesting matches coming up all over the world during the next week. You hate to start or stop watching a match midway, so your aim is to ... match whose starting time is strictly later than the finishing time of the current match? Analyze the worse-case complexity of your algorithm.
Your final exams are over and you are catching up on watching sports on TV. You have a schedule of interesting matches coming up all over the world during the next week. ...
go_editor
911
views
go_editor
asked
May 23, 2016
Algorithms
cmi2013
descriptive
algorithms
algorithm-design
+
–
5
votes
1
answer
79
CMI2012-B-03a
Let $A$ be an array of $n$ integers, sorted, so that $A[1] \leq A[2] \leq \dots A[n]$. Suppose you are given a number $x$ and you wish to find out if there are indices $k$ and $l$ such that $A[k]+A[l] = x$. Design an $O(n \log n)$ time algorithm for this problem.
Let $A$ be an array of $n$ integers, sorted, so that $A \leq A \leq \dots A[n]$. Suppose you are given a number $x$ and you wish to find out if there are indices $k$ an...
go_editor
961
views
go_editor
asked
May 23, 2016
Algorithms
cmi2012
descriptive
algorithms
algorithm-design
+
–
0
votes
2
answers
80
job scheduling
Banti Arya
1.3k
views
Banti Arya
asked
Jan 27, 2016
Algorithms
greedy-algorithm
algorithm-design
test-series
+
–
13
votes
2
answers
81
GATE CSE 1994 | Question: 7
An array $A$ contains $n$ integers in locations $A[0], A[1], \dots A[n-1]$. It is required to shift the elements of the array cyclically to the left by $K$ places, where $1\leq K \leq n-1$. An incomplete algorithm for doing this in linear time, without using another array ... j]:=____; j:=(j+K) mod n; if j<min then min:=j; end; A[(n+i-K)mod n]:=____; i:=______; end;
An array $A$ contains $n$ integers in locations $A[0], A , \dots A[n-1]$. It is required to shift the elements of the array cyclically to the left by $K$ places, where $1...
Kathleen
3.9k
views
Kathleen
asked
Oct 5, 2014
Algorithms
gate1994
algorithms
normal
algorithm-design
fill-in-the-blanks
+
–
47
votes
9
answers
82
GATE CSE 2014 Set 1 | Question: 37
There are $5$ bags labeled $1$ to $5$. All the coins in a given bag have the same weight. Some bags have coins of weight $10$ gm, others have coins of weight $11$ gm. I pick $1, 2, 4, 8, 16$ coins respectively from bags $1$ to $5$ Their total weight comes out to $323$ gm. Then the product of the labels of the bags having $11$ gm coins is ___.
There are $5$ bags labeled $1$ to $5$. All the coins in a given bag have the same weight. Some bags have coins of weight $10$ gm, others have coins of weight $11$ gm. I p...
go_editor
9.4k
views
go_editor
asked
Sep 28, 2014
Algorithms
gatecse-2014-set1
algorithms
numerical-answers
normal
algorithm-design
+
–
66
votes
10
answers
83
GATE CSE 2006 | Question: 54
Given two arrays of numbers $a_{1},...,a_{n}$ and $b_{1},...,b_{n}$ where each number is $0$ or $1$, the fastest algorithm to find the largest span $(i, j)$ such that $ a_{i}+a_{i+1}+\dots+a_{j}=b_{i}+b_{i+1}+\dots+b_{j}$ ... time in the key comparison mode Takes $\Theta (n)$ time and space Takes $O(\sqrt n)$ time only if the sum of the $2n$ elements is an even number
Given two arrays of numbers $a_{1},...,a_{n}$ and $b_{1},...,b_{n}$ where each number is $0$ or $1$, the fastest algorithm to find the largest span $(i, j)$ such that $ a...
Rucha Shelke
28.5k
views
Rucha Shelke
asked
Sep 26, 2014
Algorithms
gatecse-2006
algorithms
normal
algorithm-design
time-complexity
+
–
58
votes
7
answers
84
GATE CSE 2006 | Question: 17
An element in an array $X$ is called a leader if it is greater than all elements to the right of it in $X$. The best algorithm to find all leaders in an array solves it in linear time using a left to right pass of the array solves it in linear time using ... pass of the array solves it using divide and conquer in time $\Theta (n\log n)$ solves it in time $\Theta( n^2)$
An element in an array $X$ is called a leader if it is greater than all elements to the right of it in $X$. The best algorithm to find all leaders in an array solves it i...
Rucha Shelke
17.7k
views
Rucha Shelke
asked
Sep 17, 2014
Algorithms
gatecse-2006
algorithms
normal
algorithm-design
+
–
16
votes
5
answers
85
GATE CSE 1992 | Question: 8
Let $T$ be a Depth First Tree of a undirected graph $G$. An array $P$ indexed by the vertices of $G$ is given. $P[V]$ is the parent of vertex $V$, in $T$. Parent of the root is the root itself. Give a method for finding ... to the length of the cycle. Describe the algorithm in a PASCAL $(C)$ - like language. Assume that the variables have been suitably declared.
Let $T$ be a Depth First Tree of a undirected graph $G$. An array $P$ indexed by the vertices of $G$ is given. $P[V]$ is the parent of vertex $V$, in $T$. Parent of the r...
Kathleen
4.9k
views
Kathleen
asked
Sep 13, 2014
Algorithms
gate1992
algorithms
descriptive
algorithm-design
+
–
Page:
« prev
1
2
3
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register