CALL FOR PAPERS
and
Call For Workshop/Session Proposals
CGVR'11
The 2011 International Conference on Computer Graphics
and Virtual Reality
Date and Location:
How many elements you would have at all?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
It's a classic dynamic programming problem.
min[i][j] - minimum value for the subexpression starting at i-th position
and ending at j-th, max[i][j] - the same but stores maximum value.
Use these value to calculate value max[0][N-1], N - size of the expression.
--
You received this message
Note that there cannot be more than one celebrity in the group.
Here is an O(n) solution:
Choose a random candidate x as a possible celebrity.
Let S be the set of remaining n-1 candidates.
While (S is not empty)
Remove another candidate y from S and ask if y follows x.
Let A[0..n] be the array
Step 1: Start from A[0] and find out the first element, beyond which array
in not sorted, let's call it A[j]
Step 2: Start from A[n], move backward and find first element beyond which
array in not sorted, let's call it A[k]
so we have
A[0]A[j].A[k]A[n]
Refer to the original problem here:
http://www.topcoder.com/stat?c=problem_statementpm=1166.
And the tutorial:
http://www.topcoder.com/tc?module=Staticd1=match_editorialsd2=tco03_online_rd_4
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
There is a linear solution in terms of the matrix's size. So in a whole it
has O(n^2) time complexity.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this
its like i have two number a and b both can have max value 10^6.
i have to store a value for the pair (a,b)
i also want to access in O(1) time.
On Dec 19, 5:41 pm, juver++ avpostni...@gmail.com wrote:
How many elements you would have at all?
--
You received this message because you are
Can any1 pls tell me wat is wrng wit d following C++ program:
#includeiostream
using namespace std;
main()
{
long int k;
int no;
cinno;
while(no0)
{
int n;
cinn;
cink;
int a[3][n],bin[n],size[3];
for(int j=0;j3;j++)
{size[j]=0;
for(int i=0;in;i++)
{bin[i]=0;a[j][i]=0;}
}
long int tmp=k;
for(int
There is a city of N people. The government learnt that some
unfriendly nation planted a spy there. A spy possesses unique
characteristics: he knows everybody in the city, but nobody knows him.
You are a counteragent sent by the government to catch the spy. You
may ask the people in the city only
Doesnt the time complexity seem to be a li'l large?? Looks like its taking
exponential time...
On Sun, Dec 19, 2010 at 5:01 PM, mohit ranjan shoonya.mo...@gmail.comwrote:
Let A[0..n] be the array
Step 1: Start from A[0] and find out the first element, beyond which array
in not sorted,
Use hash_table, it provides O(1) expected time for searching.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
Is there any condition that the people in the city may or may not know each
other???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
It looks like this is a homework question. If no, send link to the original
problem.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email
how about sorting the array in an auxillary array first. then compare
the elements in sorted and un sorted array. the first elements to
differ from start and end in unsorted array constitute the sub array
we are finding. i dont know this solution seems to easy , it might be
wrong. Any comments ?
some conditions must be missed,I think.
On Sun, Dec 19, 2010 at 10:40 PM, juver++ avpostni...@gmail.com wrote:
It looks like this is a homework question. If no, send link to the original
problem.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
how to set class path for jasper reports in java?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
@mohit
can u plz explain ur algo with an example
On Sun, Dec 19, 2010 at 8:15 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
how about sorting the array in an auxillary array first. then compare
the elements in sorted and un sorted array. the first elements to
differ from start and end in
counter-agent can ask each person, did they know X( X is always him the
counter agent). N-1 max questions.
On Sun, Dec 19, 2010 at 8:16 PM, 王大东 dadongk...@gmail.com wrote:
some conditions must be missed,I think.
On Sun, Dec 19, 2010 at 10:40 PM, juver++ avpostni...@gmail.com wrote:
It
@Ankur Murarka
didn't get you, how you got time complexity as exponential, it's linear
only.
Mohit
On Sun, Dec 19, 2010 at 8:15 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
how about sorting the array in an auxillary array first. then compare
the elements in sorted and un sorted
2D matrix sum is a simple DP problem, but U need n*n extra space as well or
have to change the i/p.
(u can get the i/p back once if required)
If this is acceptable, let me explain.
Regards,
Akash Agrawal
http://tech-queries.blogspot.com/
On Sun, Dec 19, 2010 at 7:01 PM, juver++
You are given 3 integer arrays A, B and C of length n1, n2 and n3
respectively. All arrays are sorted. We define triplet of these 3
arrays as (x,y,z) where x is any integer from A, y from B and z from
C. We define distance of triplet as maximum difference among triplet
elements, i.e. Maximum of x
There is O(n^2) solution with O(n) extra space
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
Here is an algorithm:
spy = 1
for i = 2 to N do
if person[spy] knows person[i]
then person[i] is not the spy.
else if person[i] knows person[spy]
then person[spy] is not the spy, set spy = i
end if
end for
for i = 1 to spy-1 do
if (person[spy] does not know
@Snehal
you can find example here
http://geeksforgeeks.org/?p=8858
hope this will clear things for all :)
Mohit
On Sun, Dec 19, 2010 at 8:42 PM, snehal jain learner@gmail.com wrote:
@mohit
can u plz explain ur algo with an example
On Sun, Dec 19, 2010 at 8:15 PM, Ankur Khurana
Are A, B, C sorted? If so, I believe there is a O(n1+n2+n3) solution for
this question.
Thanks
On Sun, Dec 19, 2010 at 9:57 AM, Saurabh Koar saurabhkoar...@gmail.comwrote:
You are given 3 integer arrays A, B and C of length n1, n2 and n3
respectively. All arrays are sorted. We define triplet
can you please elaborate nature of inputs??
are they partially sorted or may be random.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email
@yq: Plz explain your algorithm.
On 12/20/10, yq Zhang zhangyunq...@gmail.com wrote:
Are A, B, C sorted? If so, I believe there is a O(n1+n2+n3) solution for
this question.
Thanks
On Sun, Dec 19, 2010 at 9:57 AM, Saurabh Koar
saurabhkoar...@gmail.comwrote:
You are given 3 integer arrays
i have posted this problem along with solution to my blog check :
http://code-forum.blogspot.com/2010/12/find-minimum-length-unsorted-subarray.html
On Dec 18, 10:57 pm, snehal jain learner@gmail.com wrote:
Given an unsorted array arr[0..n-1] of size n, find the minimum length
subarray
This question is equivalent to finding the minimum window contains 3 words
in a document given the position of appearance of each word in the document
by array A, B, C. This could be solved by a typical sliding window algorithm
which is O(n).
Thanks
On Sun, Dec 19, 2010 at 9:06 PM, Saurabh
@yq: Heyy yq..I m not interested in what is equivalent to what and
what is not not equivalent to what..I m interested to a specific
optimized algorithm for the specific problem stated above.If u can
figure out equivalence u can also devise the algorithm for the above
problem.Nw would u please
ok. Suppose you have 3 pointers i, j, k point to the element in A, B, C
respectively. Initialize i = j =k = 0.
for each step, you will compare A[i], B[j], C[k].
if A[i] is the smallest, i++
if B[j] is the smallest, j++
if C[k] is the smallest, k++
(this assumes numbers in A,B,C are unique, you
@yq: Thanks!!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this
33 matches
Mail list logo