@Gene
As i said in my earlier post right to left diagonal partitions the martix
into 2 equal number of elements. So now the median must be in this
diagonal. Now our focus is on finding median of this diagonal only.
I think this works fine. Can u give some test case for which it fails?
On Sun, Nov
@ Dave
I think your solution wont work for the cases like (MAX_INT) C
(MAX_INT-1).
On Thu, Nov 3, 2011 at 10:20 PM, vaibhavmitta...@gmail.com wrote:
correction: if P is prime
VM
NSIT, Dwarka
On , vaibhavmitta...@gmail.com wrote:
Use Lucas Theorem is P is prime.
VM
NSIT, Dwarka
@ myself
Dave's solution works fine. I should have close look at it.
On Sat, Nov 5, 2011 at 12:17 PM, mohit verma mohit89m...@gmail.com wrote:
@ Dave
I think your solution wont work for the cases like (MAX_INT) C
(MAX_INT-1).
On Thu, Nov 3, 2011 at 10:20 PM, vaibhavmitta...@gmail.com
@ Gene : I think your remove() function takes O(n) time in case if all n
numbers hash to same bucket.
Could you please elaborate on unbiased_hash() function?
Can't we do it like this : rand() % TABLE_SIZE coz rand() generates
uniformly distribution of numbers.
On Fri, Nov 4, 2011 at 1:47 AM,
another way is : convert binary tree to link list , sort the list and using
divide and conquer approach create the BST.
From link list to BST : find mid of sorted link list , make it root node
and put left of it to recursive(list,start,mid-prev) and
root-right=recursive(list,mid-next,last);
Let
Hi guys,
Social sites like facebook or linkedin must be having some vertex labelling
techniques. I cant' imagine what labelling they use since there are
trillions of nodes in there network ( coz simple
integer or alphanumeric labelling will not be efficient enough as far as i
think).
Can someone
I think this can be done in O(n) time simply by finding the median of
elements at DIAGNOL starting from right corner to left corner.
Coz as elements are sorted row-wise and column-wise , it implies that
elements below this diagonal are all greater than elements on this diagonal
and all above this
need to
consider the index of the array as the the vertices and the weigjht as
the the value for the movement from the present vertex to it's
connecting neighbour ..
On 10/31/11, mohit verma mohit89m...@gmail.com wrote:
Given a matrix you have to find the shortest path from one point
For the array .. And for K=3
Ur algo will give (1 1 1) (1 1 1 ) (3 5 6)
On 10/30/11, mohit verma mohit89m...@gmail.com wrote:
sort the array : O(nlogn)
keep an array/map containing frequency of each element in sorted array :
O(n)
v[n/k][k] - 2-D array of ints containing final partitions
or vertically will fail
we need to fill these both horizontally and vertically at the same time
depending upon the frequency of elements.
On Mon, Oct 31, 2011 at 6:16 PM, mohit verma mohit89m...@gmail.comwrote:
Hi SAMM,
The above code is not clear enough to understand . Sorry for that.
My idea
that there maybe negative weights then
you will need to use bellmann ford which is a DP algo.
On Mon, Oct 31, 2011 at 7:40 AM, mohit verma mohit89m...@gmail.comwrote:
I knew this could be done using Min Path finding algo. But what about DP
for this problem , guys?
On Mon, Oct 31, 2011 at 3:49 AM, SAMM
One (compressed-optional) prefix trie with each course ptrs to students and
another prefix tree for students having ptrs to courses. Guaranteed O(m)
search time instead of O(n*m) if using hash table where m avg size of word
at hand to be compared to n nodes.
On Sun, Oct 30, 2011 at 7:31 PM,
@shashank , i agree.
To reduce this overhead , we can implement prefix trie in bit-form or DAWG
or lots of compression techniques are there at the cost of complex coding.
On Tue, Nov 1, 2011 at 12:35 AM, WgpShashank shashank7andr...@gmail.comwrote:
@Mohit Space Overhead Will be more if m,n
sort the array : O(nlogn)
keep an array/map containing frequency of each element in sorted array :
O(n)
v[n/k][k] - 2-D array of ints containing final partitions.
for i=1 to n/k
{
int count=0;
for(j=0;jn count k;j++)
{ if( freq(a[i])==0) continue; //say array is used
Given a matrix you have to find the shortest path from one point to another
within the matrix. The cost of path is all the matrix entries on the way.
You can move in any direction (up, down, left, right, diagonally)
e.g.
5 9 10 1
3 7 4 4
8 2 1 9
So shortest path from (0,0) to (2,2) is
You can do something like this:
( n* alpha) * ( m*alpha) *p
where 0alpha1 which maps product onto (0,1) interval. You can use
golden ration instead.
On Sat, Oct 22, 2011 at 9:45 PM, Aamir Khan ak4u2...@gmail.com wrote:
On Sat, Oct 22, 2011 at 9:04 PM, Mad Coder
ohh , the number can repeat itself. I dint notice that.
On Fri, Oct 28, 2011 at 4:02 PM, mohit verma mohit89m...@gmail.com wrote:
something like this :
for(int i=0;temp=sum , isum/2;i++)
{ temp=temp-i;
for(int j=i+1;jtemp;j++)
couti j temp-j\n;
}
But there is a problem with code
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 more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA
@ankur - Ans-9 how can it be log n. The heap given is Max heap. I think it
should be O(n) using array or tree traversal (as heap is implemented)
keeping current min at hand. Correct me if m wrong.
On Sat, Oct 15, 2011 at 12:14 PM, shady sinv...@gmail.com wrote:
already been answered... :-/
.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
Algorithm
.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
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
it would be better if we insert values in array in while loop and then
outside call makeheapk() and then return topheap();
this will reduce the heap making complexity.
On Sun, Sep 4, 2011 at 2:29 PM, mohit verma mohit89m...@gmail.com wrote:
int funkth(node *root,int k)
{
queuenode * q
?hl=en.
--
*MOHIT VERMA*
--
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
.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You
to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received
this line is unnecessary
if(result[i]==1) continue;
I think this algo is good enough. But any improvements?
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
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 more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT
Ohh my bad. the complexity should be
O(nlogn) + O(mlogm) +O(m) = O(tlogt) where t=max(m,n)
On Sat, Sep 3, 2011 at 11:46 PM, mohit verma mohit89m...@gmail.com wrote:
create a binary search tree by scanning the whole array and if the value
already exists increase count field in that node O(nlogn
, mohit verma mohit89m...@gmail.comwrote:
Ohh my bad. the complexity should be
O(nlogn) + O(mlogm) +O(m) = O(tlogt) where t=max(m,n)
On Sat, Sep 3, 2011 at 11:46 PM, mohit verma mohit89m...@gmail.comwrote:
create a binary search tree by scanning the whole array and if the value
already exists
.
--
*MOHIT VERMA*
--
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 more
email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
=O(nlog n) for random k.
On Wed, Aug 31, 2011 at 9:15 PM, mohit verma mohit89m...@gmail.com wrote:
@ dave- commplexity of radix sort is = O(n log n). so better use heap
sort.
On Wed, Aug 31, 2011 at 4:07 PM, Dave dave_and_da...@juno.com wrote:
@Bharatkumar: You've tacitly assumed
.
--
*MOHIT VERMA*
--
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
: No. Radix sort on a fixed data type is O(n) in time, and uses
no data comparisons.
Dave
On Aug 31, 10:45 am, mohit verma mohit89m...@gmail.com wrote:
@ dave- commplexity of radix sort is = O(n log n). so better use heap
sort.
On Wed, Aug 31, 2011 at 4:07 PM, Dave dave_and_da
@mac - yeah you were right.
Normally we number the vertices and forget about their co-ordinates in
programming :)
--
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
the digits as
subscripts. Other than moving the data around, this is the only use
the radix sort makes of the sort keys.
Dave
On Aug 31, 11:06 am, mohit verma mohit89m...@gmail.com wrote:
Is anything specific about digits of numbers given in above question? If
no
then as i said
Yeah
.
--
*MOHIT VERMA*
--
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 more
.
--
*MOHIT VERMA*
--
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 more
7 8
2 4 2
1 3
9
Could someone pleases modify this solution to print tree in top-down
fashion?
On Sun, Aug 28, 2011 at 11:38 PM, Rishabbh A Dua duarish...@gmail.comwrote:
mohit, wat if the tree is growing dynamically?
On Sun, Aug 28, 2011 at 11:27 PM, mohit verma mohit89m
I think for that we need to re-traverse the tree - in first recursion
counting the levels and second time printing values and spaces accordingly.
On Sun, Aug 28, 2011 at 11:50 PM, mohit verma mohit89m...@gmail.com wrote:
i 've already mentioned if number of levels is known. Well for dynamic
to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received
without using extra
map?
--
*MOHIT VERMA*
--
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
options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
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
from array 1 on array 2?
overall complexity : O(nlogn)
On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote:
example:
array 1 :: 1 2 3 4 5 6 7 8 9 10 15
array 2:: 23 34 56 13 15 57 432 348
On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote
given two arrays : with all distinct elements but one element in common.
Find the common element in optimal time.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
example:
array 1 :: 1 2 3 4 5 6 7 8 9 10 15
array 2:: 23 34 56 13 15 57 432 348
On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote:
meaning ? what is a common element ? example ???
On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.comwrote
this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group
.
--
*MOHIT VERMA*
--
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 more
Hey guys,
can anyone post some written and interview question asked by Novell?
--
*MOHIT VERMA*
--
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
?
--
*MOHIT VERMA*
--
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 more options
to
an integer, which I think can be changed.
See if the code I suggested still does the same as your version...
On 8 August 2011 19:53, mohit verma mohit89m...@gmail.com wrote:
In c++
int d=1;
const int *const ptr = d; means ptr is const ptr to const object .So
neither ptr nor d can be changed
got it.. thanks guys
On Mon, Aug 8, 2011 at 8:00 PM, mohit verma mohit89m...@gmail.com wrote:
No .. in this case it flags error.
On Mon, Aug 8, 2011 at 7:58 PM, Dipankar Patro dip10c...@gmail.comwrote:
does the answer still remain same if you do the following:
const int d=1;
const int
.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
ohh my bad... it is working fine for all cases :)
On Sat, Aug 6, 2011 at 11:56 AM, mohit verma mohit89m...@gmail.com wrote:
what if the alphabet is {a,b,c,d} and we have to print substrings of length
2 or 3 ?
On Sat, Aug 6, 2011 at 11:01 AM, Tushar Bindal tushicom...@gmail.comwrote
.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
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
.
--
*MOHIT VERMA*
--
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 more options, visit
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 more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA
/algogeeks?hl=en.
--
*MOHIT VERMA*
--
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
task with its corresponding
running time and associate function. In that case how will find the task
which has the closed running time.
If you use min heap it would be easy to find the task that has closest
runing time in O(1) complexity.
On Thu, Aug 4, 2011 at 10:57 AM, mohit verma mohit89m
ohh my bad... the array should be 1-D with N ptrs for each fgets() we put
returned ptr to array and after getting loop back N times.
On Thu, Aug 4, 2011 at 11:52 PM, mohit verma mohit89m...@gmail.com wrote:
How did the microsoft guy write tail without using seek()?
one solution
/algogeeks?hl=en.
--
*MOHIT VERMA*
--
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
to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message
to private
members of base class(Or even copy them to derived class memory space in
private section). So how can the above program can run successfully? Could
someone elaborate on inheritance internals : what is going on in this case?
--
*MOHIT VERMA*
--
You received this message
email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
*MOHIT VERMA*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
hi all,
can anyone tell me how can one recognize a given problem whether it is NP
complete or incomplete or N complete in some considerable time limit.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
69 matches
Mail list logo