@Don,
Can u explain with an Example...?
With regards,
Balasubramanian Naagarajan,
Chettinad
College of Engg Tech.
On Sat, Jan 5, 2013 at 1:48 PM, Malathi malu@gmail.com wrote:
Check this. It might help.
Can u please explain ur code..!!!
--
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
can u explain ur algorithm for the sequence
*
5 4 3 2 1*
--
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
why am i getting run time error.?
problem=https://www.spoj.pl/problems/DCEPC206/
my code:
#includestdio.h
int main()
{
short t;
long n,i,c,prev;
long a;
scanf(%d,t);
while(t--)
{
c=0;
scanf(%ld,n);
scanf(%ld,prev);
c=prev;
for(i=1;in;i++)
{
scanf(%ld,a);
if(a==prev);
I dont know if it can be solved in O(n). But O(nlogn) can be done using
BIT. Refer topcoder tutorial for Binary indexed trees.
On Mon, Apr 9, 2012 at 10:56 AM, tarun chabarwal admin20...@gmail.comwrote:
how should i approach this problem
https://www.spoj.pl/problems/DCEPC206/
can it be
sorry dude it came to ITBHU with tag of marketing so i could not be
helpful to u in this case.
On 4/1/12, Deepak Garg deepakgarg...@gmail.com wrote:
hey guys!
google is coming to our college, their main requirements is from
operating systems and computer networks.
can some one post the
Hey group,
This is kind of a cliched question but given a file with billion numbers
and the task is to compute 'k' largest numbers from this file, what
approach is preferred?
1) Using heaps
2) Using Median-of-median algorithm.
Have read few links which prefer heaps but clearly median of median
The in-order and pre-order traversal are already given. So, there is no way
to do what you are saying if I understand you completely.
On Sun, Nov 27, 2011 at 8:19 AM, Ankuj Gupta ankuj2...@gmail.com wrote:
Hint : try with prestoring the preorder traversal element position in
inorder traversal
*Assumptions*:
- All positive elements in the array
- All elements in array are in range 0 to (n-1) [ n - # of elements]
1) Scan the array. For every element A[i], negate the value stored in
A[A[i]].
2) If you encounter an element already negated, then that represents the
duplicate element.
On
Given a set of values..in which there are some dependencies..
Eg.. x y z a b
Dependencies: x,y
a,z
Note that dependency is not transitive..Is it possible to separate
these elements into sets such that no two elements in the same set are
dependant and we should end up with the least number of
Can anyone please explain the logic instead of the actual code?
Sent from iPhone.
On Aug 31, 2011, at 4:16 AM, aditya kumar aditya.kumar130...@gmail.com wrote:
@rohit : else return (check(tree-left) || check(tree-right)); should be
else return (check(tree-left) check(tree-right));
Sukran,
There's a thread I started recently which asks about binary tree
isomorphism. But to sum it all up here, isomorphism refers to same
structure. Though isomorphism is used pretty flexibly w.r.t to binary
trees, here's what I have read from different sources.
- 2 binary trees are isomorphic
not require any transformation themselves. See below link:
http://www.cs.duke.edu/courses/spring00/cps100/assign/trees/
Bharath.
On Aug 28, 11:53 pm, muthu raj muthura...@gmail.com wrote:
In Amazon written test Isomorphic trees were defined as those in
which a
series
@Amit: Thanks for the solution but I have seen this approach. I was
wondering how this can be solved using linked lists without using
bignum libraries.
Bharath
On Jul 31, 12:38 pm, amit karmakar amit.codenam...@gmail.com wrote:
Since long long cannot store the 100th Fibonacci number, you need
not
come into picture when 2 big numbers are added, there is no problem.
As an optimization, one can use linked lists for addition only when
values get close to max integer value.
Bharath.
On Jul 31, 8:38 pm, saurabh singh saurab...@gmail.com wrote:
By creating a bugnum library using link list
Can anyone give the recursive version of reversing a linked list. Please
post the reverse function code snippet and not the entire .c file since it
just hampers readability.
Bharath.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
The subject has the problem description. What are some efficient ways of
doing this. As always, the approach description is more useful than the
actual code itself.
Thanks!
Bharath.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
Master's theorem is for recursive programs only. In general, there is
no golden rule to calculate time complexity.
Few pointers are to identify the key operations (eg - loops) and
analyze the estimated running time based on a input size.
On Jul 27, 2:46 pm, rajeev bharshetty rajeevr...@gmail.com
records are stored in a single chunk,
bringing the chunk into memeory is good enough. An additional storage
structure will not be required.
On Jul 28, 1:27 am, Puneet Gautam puneet.nsi...@gmail.com wrote:
@bharath: To store the bunch of records together also, we gonna need
another useful ds like
A B+ tree would have one pointer for every data record at the leaf
level. You could additionally group a bunch of data records together
and have a single pointer from leaf to the data block. The trade-off
is that you will have to fetch the data block and sequentially parse
it to search for an
@Dumanshu: A B+ tree is a multi-level index. It indexes the index
until the final level is small enough to fit into a data block that
can fit in memory.
On Jul 27, 10:11 pm, Dumanshu duman...@gmail.com wrote:
Use multilevel indexing
On Jul 27, 11:07 pm, himanshu kansal
Given an expression (A+(B*C)), remove redundant parentheses. Output in
this case should be A+B*C.
My initial solution:
(1) Convert expression from infix to postfix (or prefix) [This way,
all parentheses are removed]
(2) Now, convert postfix (or prefix) expression back to infix.
Is there a better
information lost. So, it will eventually again return
back (A+(B*C)).
So, my approach will not work. Any solutions then?
On Jul 26, 3:26 pm, bharath bharath.sri...@gmail.com wrote:
Given an expression (A+(B*C)), remove redundant parentheses. Output in
this case should be A+B*C.
My initial solution:
(1
Well, the answer should still be in infix except without 'redundant'
parantheses. So, just converting it to prefix/postfix will not do. If we
were to scan the array and remove parentheses, you might end up deleting
relevant ones. Eg: ((A+B)*C) should output (A+B)*C. So, the key point here
is
We can use count sort to solve this. Assuming each element is the
array is in range 1-k (k=O(n)).
for (i=0 to n)
C[A[i]]=C[A[i]]+1
for (i=1 to k)
C[i]=C[i]+C[i-1]
Array 'C' will have the resultant array.
On Jul 26, 9:20 pm, Rajeev Kumar rajeevprasa...@gmail.com wrote:
*
Algorithm :
Oops, my bad. I missed that lowest in a[i+1...n] part.
On Jul 26, 10:17 pm, ankit sambyal ankitsamb...@gmail.com wrote:
@bharath :I think array C is not the resultant array. Take an example and
explain
--
You received this message because you are subscribed to the Google Groups
Algorithm
This is the extended Josephus problem. More details and solution
formulation here:
http://www.cs.man.ac.uk/~shamsbaa/Josephus.pdf
On Jul 26, 11:04 pm, Nikhil Gupta nikhilgupta2...@gmail.com wrote:
Please suggest a good algo for this :
You have numbers 1 to n (consider them arranged in a
I think I figured out a solution. Please correct me if I missed anything.
*Example:*
Input: ((A+B)*C)
Expected output: (A+B)*C
*Assumptions:*
- Peek (queue) just tells the element in front end of queue without deleting
it.
- precedence( ) is a function which looks a precedence table of
node * reverse(node *head)
{
if(head-next)
{
node * temp=reverse(head-next);
head-next-next=head;
head-next=NULL;
return temp;
}
return head;
}
On Sun, Jul 17, 2011 at 4:57 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
*node *reverse(node
.
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.
--
...Thanks
Bharath
--
You received this message
.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
...Thanks
Bharath
--
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
whole expression is not correct...
i guess it explains all.. :)
On Sat, Mar 26, 2011 at 6:32 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:
Bharath can u tell me how u came with the combine function ??? I can't
understand the logic behind it ... do reply
On Wed, Mar 16, 2011 at 10:24 PM
i found this good..
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor
On Mon, Mar 21, 2011 at 6:02 PM, Anurag atri anu.anurag@gmail.comwrote:
yes , please suggest a nice tutorial for segment trees ..
On Mon, Mar 21, 2011 at 5:48 PM, cegprakash
but..i read this oly after my senior taught me segment trees..
On Wed, Mar 23, 2011 at 4:43 PM, bharath kannan bharathgo...@gmail.comwrote:
i found this good..
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor
On Mon, Mar 21, 2011 at 6:02 PM, Anurag atri
I guess you solve it using binary search..
On Wed, Mar 23, 2011 at 6:48 PM, Vishnutej
mylavarapu.vishnu...@gmail.comwrote:
Hello everyone,
Im unable to understand the NUMGUESS problem in SPOJ.Can some one
explain what the problem is about?
Thanks in advance.
-Vishnutej.Mylavarapu
--
, 2011 at 10:40 AM, bharath kannan
bharathgo...@gmail.comwrote:
i thot tat i had some mistake in my code and typed it all over again..
finally i noticed this :)
On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:
Hey..
I also got into same trouble today...
I submitted
http://www.spoj.pl/forum/viewtopic.php?f=3t=5240p=20667hilit=BRCKTS#p20667
if u know d basics of segment tree..then this thread will help for solving
this prob :)
On Sun, Mar 20, 2011 at 2:11 AM, murthy.krishn...@gmail.com
murthy.krishn...@gmail.com wrote:
can any 1 explain why we have 2 use
i thot tat i had some mistake in my code and typed it all over again..
finally i noticed this :)
On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:
Hey..
I also got into same trouble today...
I submitted it 6 times..then got bored and de moralised cause i cudnt find
sorry guyz...
Had to print YES n NO..
i printed as Yes n No...
Got ac..
Sorry for the trouble..
On Wed, Mar 16, 2011 at 10:24 PM, Bharath 2009503507 CSE
bharathgo...@gmail.com wrote:
i am new to segment trees..i tried this problem in spoj..
http://www.spoj.pl/problems/BRCKTS
am getting WA
)
printf(Yes\n);
else
printf(No\n);
}
else
update(1,0,str.size()-1,k-1);
}
}
}
Thanks in advace..
Bharath..
--
You
a small modification in normal knapsack algo ll do :)
On Thu, Feb 24, 2011 at 4:06 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
http://www.spoj.pl/problems/PIGBANK/
can anyone give me an idea how to solve this problem...?? I dont think
the knapsack algo would be of help here as here we
i tried solving this prob...
http://www.spoj.pl/problems/POUR1/
i tried using BFS...getting TLE in judge..
pl suggest some optimisation or better solution..
Thanks in advance..
Code:
http://ideone.com/qIgcU
--
You received this message because you are subscribed to the Google Groups
machi use this..
Define *m*[*i*,*w*] to be the maximum value that can be attained with weight
less than or equal to *w* using items up to *i*.
We can define *m*[*i*,*w*] recursively as follows:
- [image: m[0,\,w]=0]
- [image: m[i,\,0]=0]
- [image: m[i,\,w]=m[i-1,\,w]] if [image:
refer topcoder tutorials..dp
On Wed, Dec 15, 2010 at 12:12 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
how do we find the complexity of DP program ? i know it cn be done
using DP states , but the gien complexity is n^2 . i am not sure how
to compare that
On Tue, Dec 14, 2010 at
I tried solving that prob..here's my code
#includeiostream
#includestring
using namespace std;
main()
{
string s;
cins;
while(1)
{
if(s.size()==1 s[0]=='*')
break;
int length=1,curr=0,start=0,count=1;
for(int i=1;is.size();i++)
{
if(s[i]!=s[curr]
i am a beginner.pl help me with this code.i submitted a solution.it s
giving op for all given testcases.but the judge is giving me a TLE.
code:
#includeiostream
#includemap
#define inf 9
using namespace std;
mapint,int m2;
int func(mapint,int m1,int w)
{
if(m2[w]inf)
return m2[w];
sum of n elements from 1=n(n+1)/2
product from 1 to n=n!
calculate dis..
sum=calculated sum-orig sum
prod=calculated prod-orig prod
with dis form quadratic eq and solve...
hope this works...
On Tue, Oct 12, 2010 at 12:29 AM, Asquare anshika.sp...@gmail.com wrote:
Given an array of size n. It
://groups.google.com/group/algogeeks?hl=en.
--
Bharath
--
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
at
http://groups.google.com/group/algogeeks?hl=en.
--
Bharath
--
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
://groups.google.com/group/algogeeks?hl=en.
--
Bharath
--
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
-- One can store the binary equivalent of the number of zeros in each
line... and carry on from there
--
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
.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
Bharath
--
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
=en.
--
Bharath
--
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
...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
Bharath
--
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
.
--
Bharath
--
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 group
Bsearch on diagonal elimanates all the submatrix under 9.
You are left with only one column and a row.Do BinarySearch on these lists.
On Wed, Nov 25, 2009 at 6:07 PM, chitta koushik
koushik.infin...@gmail.comwrote:
@Bharath
I dont think BinSrch on diagnol and then on row works.
Can u
...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=.
--
Bharath
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge
!
and if you made it, the minimal number if moves is equal to MIN (X,
2*N - X)
you can also use this method for an M*N matrix !
Hope it helps ^-^
On Sep 19, 3:02 pm, Bharath Kumar bharath1...@gmail.com wrote:
Given two square matrices(initial and final) consisting of elements
either
1
store k numbers from that tape as the tape is
progressing, so that you can present them when prompted.
--
Try the new Yahoo! India Homepage. Click
herehttp://in.rd.yahoo.com/tagline_metro_1/*http://in.yahoo.com/trynew
.
--
Bharath
13 apples? What is the best
approach to solution which is near to optimal balance?
I request you to provide the idea to resolve this problem.
Thanks Regards,
Sandeep
--
Bharath
--~--~-~--~~~---~--~~
You received this message because you are subscribed
You can use a hash map. What do u mean by preserving order?
Keep inserting the characters into hash, whenever u find a duplicate,
delete it. The order is maintained still. Can you please elaborate on
what is mean by preserving order?
On Sep 8, 10:47 am, yash yashpal.j...@gmail.com wrote:
wap a
, ankur aggarwal ankur.mast@gmail.comwrote:
@barath
u r using extra space..
wat is new about this sol
change to array..
then do as simple
using a[i]==a[n-i] ???
On Tue, Sep 8, 2009 at 8:04 PM, Bharath bharath1...@gmail.com wrote:
Q: Check whether given singly linked list
If the range of numbers is known, sort the array using radix sort and
compare difference of adjacent elements.
On Sep 2, 2:33 pm, Varun S V varun...@gmail.com wrote:
Sorry this doesnt work. The difference between any other two sets can be
lesser than the difference between two min numbers.
63 matches
Mail list logo