Could someone illustrate the XOR for question 2. I am a beginner to this.
Many thanks!
On Thu, Jun 9, 2011 at 4:58 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
Xoring it twice ...once with the elements in the file and then from i=1 to
4,000,000,000..the answer left is the missing number
I think RGGB is invalid as we have 4 different colors.
On Fri, Jun 10, 2011 at 10:10 AM, Harshal hc4...@gmail.com wrote:
#includeiostream
#includestring
using namespace std;
void mastermind(char* guess, char* sol, int *hits, int *pseudohits)
{
int temp[256] = {0};
int
How will BFS give a rearrangement ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For
int max_calls[no_of_customers][30];
On any phone call -- max_calls[customer_id][day]++;
On hangup -- max_call[customer_id][day]--;
This would store max calls for each customer on each day. Does the length of
the call have to be taken into account ? Your question is not clear on that.
On Tue,
]--;
On Tue, Mar 29, 2011 at 4:29 PM, Ashim Kapoor ashimkap...@gmail.com wrote:
int max_calls[no_of_customers][30];
On any phone call -- max_calls[customer_id][day]++;
On hangup -- max_call[customer_id][day]--;
This would store max calls for each customer on each day. Does the length
of the call
On Fri, Apr 1, 2011 at 6:02 PM, snehal jain learner@gmail.com wrote:
For a set S of n real numbers, a pair of elements x, y belong to S,
where x y, are said to be close if
y – x = ( max(S) – min(S) ) / (n-1)
Suppose you are given an unsorted array A[1 : n] of distinct real
numbers.
One more query, insert into bst is O(n) and then do inorder to get them in
sorted order. This is an example of sorting in O(n) time. is this correct?
On Mon, Mar 28, 2011 at 6:06 PM, Ashim Kapoor ashimkap...@gmail.com wrote:
How do you use inorder traversal to find longest sub sequence
How do you use inorder traversal to find longest sub sequence?
On Mon, Mar 28, 2011 at 6:03 PM, bittu shashank7andr...@gmail.com wrote:
its (not aplicable).
sorting nlogn i said time O(n) O(1) space
i think we can use BST , put all elements in BST O(n) then do inorder
to find longest
Hi , Use Hashing for That , for sum =12 arr[]={2,4,3,6,5,8,7}; store
in to hashtable for each index=0 in loop find sum-arr[index] so
fro sum =12 if we do index=1 a[1]=4 sum-a[1]=8 so stop it we have
done..hope make d perfect code.
time Complxity o(n) space size of hashtable
Let me
Dear Shashank,
What you are trying to do is called Goldbach's conjecture . Google for
it. There is a million dollar prize to prove it.
Ashim
On Thu, Mar 24, 2011 at 8:03 PM, ligerdave david.c...@gmail.com wrote:
I have to say: to prove the correctness of this hypotheses is a
wrong question
I think the output is wrong. It should be
1 3 4 9 n in no call them ai's a[1] to a[n]
4 5 10 7 12 13 m in no call them bi's b[1] to b[m]
I assume starting from 1 to make manipulation easier
n(n-1)/2= m
n(n-1)=2m
n2 -n -2m=0
using quadratic formula:-
n=1 + sqrt( 1+8m)/2
This will always be a
That is exactly what my solution is doing.
On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal
ashish.cooldude...@gmail.com wrote:
There must be another good solution..please let me know .
Thanks
On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal
ashish.cooldude...@gmail.com wrote:
I think..
also since each object is a rigid body each point in any one object will
have the same equation of motion.
On Wed, Feb 16, 2011 at 8:04 PM, Ashim Kapoor ashimkap...@gmail.com wrote:
Here is my attempt it's very naive but maybe someone can improve
each object be a pointer to a set of points
Here is my attempt it's very naive but maybe someone can improve
each object be a pointer to a set of points { these points are the boundary
of the object }
Collision detection : Sweep through each pair of pointers to check for
equality of the boundary points.
an example , there are 3 objects
Let me try. Any thing involving n would leave no remainder.
so (1 + 2 ! + ... + n ! + + N !) mod n = (1 + 2 ! + ... + (n-1)! ) mod
n
This should be computed from a loop. I don't know how to reduce it further.
Ashim.
On Wed, Dec 8, 2010 at 6:49 PM, ankit sablok ankit4...@gmail.com wrote:
What if we have an array :-
index - 1 2 3 4 5
value - 1 2 3 4 5
How will ANY logn solution determine all ALL elements are equal to it's
index value ? Maybe I misunderstand.
Thank you,
Ashim
On Sat, Dec 4, 2010 at 5:38 PM, ankit sablok ankit4...@gmail.com wrote:
u can then move to other
yaar I can use simple O(n) sweep to find out who all are equal, I think it
can't be less than this
On Sat, Dec 4, 2010 at 8:05 PM, Abioy Sun abioy@gmail.com wrote:
2010/12/4 ankit sablok ankit4...@gmail.com:
as all the elements are sorted in the array make a min heap of the
array
Do you mean if the rank of a student is better than the rank of the prev
student then he/she gets a lollipop?
Thank you,
Ashim
On Sun, Nov 21, 2010 at 6:57 PM, vamsee marpu marpu.vam...@gmail.comwrote:
Does anybody know the solution for the following problem :
*A headmaster of a primary
Is'nt this solvable by the majority vote algorithm already discussed in this
list?
Ashim.
On Sun, Nov 7, 2010 at 3:42 AM, lichenga2404 lichenga2...@gmail.com wrote:
There are many secret groups in College A.Every student at college A
is a member or these secret group, though membership in one
I'm not sure what a 2 hash table is. Can you please explain ?
On Tue, Oct 19, 2010 at 10:36 PM, MOHIT mohit...@gmail.com wrote:
o(n) soln
Lets say A is the array of length N.
Create an array sum of length N and initialize it to 0.
Create an array product of length N and initialize it
what is this red book ?full name please?
On Fri, Sep 17, 2010 at 1:01 PM, vikas kumar vikas.kumar...@gmail.comwrote:
use opengl library to draw the graph or whatever. take RED BOOK for
reference.
On Sep 14, 5:54 pm, Mithun avmit...@gmail.com wrote:
Can anyone help me with the code for
How would you define 50% or more similarity ?
On Sun, Sep 12, 2010 at 6:49 PM, Chi c...@linuxdna.com wrote:
trie
On Sep 12, 3:09 pm, sharad kumar aryansmit3...@gmail.com wrote:
pagerank algo
On Sun, Sep 12, 2010 at 5:42 PM, Snoopy Me thesnoop...@gmail.com
wrote:
You are given
The majority vote program ( discussed a couple of days ago ) would work in
this case I think. In the end we would have the modal element with count = 0
(n - n ). Please correct me if I am wrong.
On Sat, Sep 11, 2010 at 3:00 PM, bittu shashank7andr...@gmail.com wrote:
Given an array of 2n
I can do it in 2 O(n)sweeps if all elements are distinct.
12345
23451
Sweep one to find the 1st element of string 1 in string 2.
Sweep 2 to compare each element of the 2 strings from the position mod n
found in the 1st sweep.
I dont know how to do it if elements are repeated.
but the way
int a[]={11,9,8,2,10,7,3,4,5}
max_length = 1 ;
current_length = 1;
first_position=0 ;
last_position = 0 ;
first_position_max=0;
// Sweep one to find the length of the longest subsequence.
for ( i = 1 ; i n ; i++ ) {
if ( a[i] a[i-1] ) {
last_position=i-1;
sure, but the implementation is confusing. My question is does not the 2nd
count overwrite the 1st value of count in side the function?
Thank you.
On Sun, Aug 22, 2010 at 1:04 AM, Harshal ..Bet oN iT!! hc4...@gmail.comwrote:
if it is a min heap,, then traversing down from the root node, it
Dear All,
I found this in the book by skeina.
Problem: Given an array-based heap on n elements and a real number x,
efficiently
determine whether the kth smallest element in the heap is greater than or
equal
to x. Your algorithm should be O(k) in the worst-case, independent of the
size of
the
I am not sure, but can I do this using a suffix trie ? any comments ?
On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel ashg...@gmail.com wrote:
solution could be to find the charcter position from both sides for each
char of s2
then from the 2*n array, find the smallest index from left and
are you referring to the lectures by Dr Naveen Garg ? Or are these lectures
different? Please clarify.
Thank you,
Ashim.
On Sat, Apr 17, 2010 at 5:43 AM, rahul rai raikra...@gmail.com wrote:
On 4/16/10, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
Just got another O(n) solution.
Find
I think it can be done in logn time ( I assume the list is sorted, is there
an order log n sorting algo, then i can even sort it in log n time ? ( I am
new to algorithms ) ).
1. binary search for low=x1.
2. binary search for high=x2.
both will take log n time. Print all values between them then
30 matches
Mail list logo