wont recursion will also be resource (time) intensive because of the
multiple function call which is not observed in iterative procedures.
On Tue, Jun 14, 2011 at 7:30 AM, Navneet Gupta navneetn...@gmail.comwrote:
Recursion is the best way to write compact programs for what might
seem as
http://www.freepuzzles.com/puzzles/PuzzlePage.asp?PuzzleNumber=Geom003CategoryID=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
Not really, time to push and pop functions from stack is not included in
algorithm analysis because it would ultimately be compiler/machine dependent
Also running time of algorithms is very much a theoritical concept which
works for most practical purposes.
On Tue, Jun 14, 2011 at 11:31 AM,
hi,
the way XOR operation works i.e 0 for duplicates is used the most.
A practical application that i know is , XOR is used for Forward Error
correction
for packet loss over a network. It works on the same principle like the
duplicate problem.
Another application that i know is for Error
Navneet can you point to some resources ?
Iterative procedures are generally faster than recursion unless it is not
required to fill the table completely.
On Tue, Jun 14, 2011 at 11:39 AM, Navneet Gupta navneetn...@gmail.comwrote:
Not really, time to push and pop functions from stack is not
Another use of XOR is to generate some random numbers
And XOR is extensively used in the field of CryptoGraphy !!!
--
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
*Sign Puzzle - 14 june
*
*
*
*As the school year was progressing, a teacher was distressed that more and
more of her students were beginning to tease and make fun of one another.
She decided to do something about it. When they returned to the classroom
after Spring Break, they saw a mirror on
Design an elevator system for a 100 story building. Address all issues, like
number of elevators, speed of each (Not numerically), waiting times etc.
There would be 100-200 people living/working on each floor. (You don't need
to discuss the traffic patterns.)
--
You received this message because
I LIKE YOU LIKE YOU ARE
On Tue, Jun 14, 2011 at 12:09 AM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Sign Puzzle - 14 june
*
*
*
*As the school year was progressing, a teacher was distressed that more
and more of her students were beginning to tease and make fun of one
another. She
What about precedence order then.
http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence order
should be evaluated before || in the second exampleresult should be
k=1,j=3 and i= -2
On Mon, Jun 13, 2011 at 11:41 AM, udit sharma sharmaudit...@gmail.comwrote:
hmm. Sry yr...
Hi All
I tried going through the code here for constructing suffix tires -
http://marknelson.us/1996/08/01/suffix-trees/
But I am not sure I get it well. If its ok, can we discuss this
implementation.
Thanks
Supraja J
--
U
--
You received this message because you are subscribed to the
Hey Supraja,
Just a request, since this is a high volume mailing list, you should make
your subject very informative. Hi isn't very descriptive you know. :)
I'm changing the subject to Suffix Trees Discussion and reposting your
question. Hope people are more interested in following the thread
it means that time has come for you to get banned. Very bad puzzle. Oh,
sorry, it was a joke.
On Tue, Jun 14, 2011 at 12:39 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Sign Puzzle - 14 june
*
*
*
*As the school year was progressing, a teacher was distressed that more
and more of her
Hi,
How to find the shortest path in a 4-ary tree in an optimal way?
Node tree{
Node *left,*right,*top,*bottom;
int val;
};
Let the above given be the tree structure.
--
Thanks and regards,
Raghavan.K.L
http://in.linkedin.com/in/raghavankl
--
You received this message because you are
Did you mean Shortest path from one node to another
Use BFS i think we can find the shortest path
On Tue, Jun 14, 2011 at 5:37 PM, Raghavan its...@gmail.com wrote:
Hi,
How to find the shortest path in a 4-ary tree in an optimal way?
Node tree{
Node *left,*right,*top,*bottom;
int val;
Sorry, i confused val with weight of the edge.
BFS would be a better option.
On Jun 14, 5:31 pm, L prnk.bhatna...@gmail.com wrote:
Any graph algorithm would work.
If val is positive then use Dijkstra's algorithm, otherwise use
Bellman Ford.
On Jun 14, 5:07 pm, Raghavan its...@gmail.com
same as left right or top
u can consider as each node as a cell of grid type of thing for easy
understanding
On Tue, Jun 14, 2011 at 5:59 PM, vaibhav agarwal vibhu.bitspil...@gmail.com
wrote:
What actually is meant by bottom pointer
On Tue, Jun 14, 2011 at 5:57 PM, sunny agrawal
What actually is meant by bottom pointer
On Tue, Jun 14, 2011 at 5:57 PM, sunny agrawal sunny816.i...@gmail.comwrote:
Did you mean Shortest path from one node to another
Use BFS i think we can find the shortest path
On Tue, Jun 14, 2011 at 5:37 PM, Raghavan its...@gmail.com wrote:
Hi,
Any graph algorithm would work.
If val is positive then use Dijkstra's algorithm, otherwise use
Bellman Ford.
On Jun 14, 5:07 pm, Raghavan its...@gmail.com wrote:
Hi,
How to find the shortest path in a 4-ary tree in an optimal way?
Node tree{
Node *left,*right,*top,*bottom;
int val;
};
Ok lemme add some more details to it.
See it is a kind of n-ary tree having n=4 and each pointer is represented as
left, right,top and bottom compare it to the four directions.
So the shortest path starting from the root node to the leaf node where the
val = 1000, taken into consideration there
I found one interesting question
Given a string s , return the shortest substring that is
only occurring once.
Examples:
s=aabbabbaab gives either bab or baa
s= gives
My Approaches
Generate All Possible SubStrings O(N^2)
puts all substrings into hashtable keep incrementing counter for
Good one! That halved the memory requirement. :)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/N6mbMaJHO64J.
To post to this group, send email to
Folks,
This question was asked during a screening process of a product based
company. Please answer.
http://exploreriddles.blogspot.com/2011/06/interview-questions-puzzle.html
Thanks Regards
Vishal Jain
Success taste better when target achieved is bigger.
P *We have a responsibility to the
This looks like a good problem. Could you confirm if string contains only
two characters as you mentioned in both examples or it is a general string
with any characters.
On Tue, Jun 14, 2011 at 6:33 PM, bittu shashank7andr...@gmail.com wrote:
I found one interesting question
Given a string s
it must be any general string
Suffix tree approach seems best both in time and space complexity
On Tue, Jun 14, 2011 at 7:36 PM, Navneet Gupta navneetn...@gmail.comwrote:
This looks like a good problem. Could you confirm if string contains only
two characters as you mentioned in both
Put one red ball in one jar and rest 99 balls in other jar.
Probability in that case is 1/2*1 + 1/2*49//99
On Tue, Jun 14, 2011 at 7:45 PM, Vishal Jain jainv...@gmail.com wrote:
Folks,
This question was asked during a screening process of a product based
company. Please answer.
is such a declaration correct:
cinx;
int a[x];
--
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
no
the no of elements in an array should be known to compiler before execution
of the program.
On Tue, Jun 14, 2011 at 8:09 PM, amit amitthecoo...@gmail.com wrote:
is such a declaration correct:
cinx;
int a[x];
--
You received this message because you are subscribed to the Google Groups
One line or the other is not correct. The size of an array must be a
constant, and you can't read into a const.
If you want to do something like this, use malloc:
cin x;
int *a = (int *)malloc(x*sizeof(int));
You can now use a as if it is an array of size x. Be sure to free
the memory before a
but such a declaration is working correctly in g++
On Tue, Jun 14, 2011 at 8:22 PM, Don dondod...@gmail.com wrote:
One line or the other is not correct. The size of an array must be a
constant, and you can't read into a const.
If you want to do something like this, use malloc:
cin x;
int
it is correct ...in c++ 4.3.2 compiler
--
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.
anybody having idea about preference order ??
On Tue, Jun 14, 2011 at 4:20 AM, nicks crazy.logic.k...@gmail.com wrote:
What about precedence order then.
http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence
order should be evaluated before || in the second
It is important to remember that xor is a bitwise operator, so x ^= y
affects the individual bits of x based on the bits in y.
Think of xor as a bitwise not-equal operator. The expression
a = x ^ y
Will set the bits of a to true if the corresponding bits of x and
y are not equal.
Thus the xor
Its not a standard, it is one of the gcc extension i.e variable length
arrays. Memory allocation is done dynamically from stack in such case.
On Tue, Jun 14, 2011 at 8:27 PM, kartik sachan kartik.sac...@gmail.comwrote:
it is correct ...in c++ 4.3.2 compiler
--
You received this message
But generating a suffix tree itself is O(n2) .
On Tue, Jun 14, 2011 at 7:54 PM, sunny agrawal sunny816.i...@gmail.comwrote:
it must be any general string
Suffix tree approach seems best both in time and space complexity
On Tue, Jun 14, 2011 at 7:36 PM, Navneet Gupta
according to precedence
m= ++i || ++j ++k
will become
m = ++i || (++j ++k);NOT this m = (++i || ++j) ++k;
first i gets incremented and since that gives a non-zero value the rest of
the statement is not executed.
On Tue, Jun 14, 2011 at 8:41 PM, nicks
bt increment operator has the higher precedence than || and
so all the variables should be incremented first then and then ||
should be evaluated
then how it is happening.plz explain
rahul dixit
Du-Mca
--
You received this message because you are subscribed to the Google Groups
Algorithm
hmm...someone explain...me too confused :(
On Tue, Jun 14, 2011 at 9:14 AM, rahul dixit dixit.rahu...@gmail.comwrote:
bt increment operator has the higher precedence than || and
so all the variables should be incremented first then and then ||
should be evaluated
then how it is
https://www.spoj.pl/problems/NTKM/
my code is :
# includeiostream
# includecstdio
# includealgorithm
using namespace std;
int main()
{
long long int n;
while(1)
{
long long int a[1]={0},i;
if(scanf(%lld,n)==EOF)
break;
for(i=0;in;i++)
scanf(%lld,a[i]);
that is what is happening here
m = ++i || (++j ++k);
in C if P = Q || R;
first it checks Q if that is NOT true then it computes C else it doesn't.
++ is a unary operator so before the || and operations can happen
increment will take place. This justifies the higher precedence of ++
first it checks Q if that is NOT true then it computes R else it doesn't.
this is the correct line .
On Tue, Jun 14, 2011 at 10:21 PM, snehi jain snehijai...@gmail.com wrote:
that is what is happening here
m = ++i || (++j ++k);
in C if P = Q || R;
first it checks Q if that is NOT
got AC silliy mistake i am sorting array only one time..
--
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
case like
5
1 2 3 45
got worng ans
--
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
@sunny... yeah sorry, m stupid..:)
thanx
On Tue, Jun 14, 2011 at 10:52 AM, sunny agrawal sunny816.i...@gmail.comwrote:
@tech rascal
10 = 01010
20 = 10100
--
xor = 0
= 30
why r u getting 1 ??
On Tue, Jun 14, 2011 at 2:28 AM, Supraja Jayakumar
@Sunny: what if the number is repeated multiple times? u seem to
consider only the duplicates(2 times).
On Jun 13, 7:36 pm, sunny agrawal sunny816.i...@gmail.com wrote:
no we can take care of duplicates without any extra memory
modify 2nd step of my previous solution as follows
if T[a[i]] is
Hello Associate,
Please go through the below requirement and let me know if you have any
consultants for the below position.
Job Title: Java Developer
Location: Pittsburgh, PA
Duration: 2-3 Months
Rate: $45/hour C2C
Description: The candidate should be well versed with the following
i meant if N = { 1, 1, 1, 2, 12}
and M = { 1, 1, 3, 12}
then answer should be = {1, 1, 12}
On Mon, Jun 13, 2011 at 8:06 PM, sunny agrawal sunny816.i...@gmail.comwrote:
no we can take care of duplicates without any extra memory
modify 2nd step of my previous solution as follows
if T[a[i]] is
henry will give the answer that will favour to save him.. so if rotated then
probab. of getting safe is 2/3=0.666
and if not rotated then probab. of getting safe is 3/4=0.75 so its better to
not to rotate..
On Tue, Jun 14, 2011 at 12:36 AM, Arpit Sood soodfi...@gmail.com wrote:
+1 to Kunal's
@Akshay
Suffix tree construction is O(n)
On Jun 14, 8:58 pm, Akshay Rastogi akr...@gmail.com wrote:
But generating a suffix tree itself is O(n2) .
On Tue, Jun 14, 2011 at 7:54 PM, sunny agrawal sunny816.i...@gmail.comwrote:
it must be any general string
Suffix tree approach seems
@bittu
How can u find the shortest substring from the tree in 0(n). Can u
please elaborate a bit ?
On Jun 14, 6:03 pm, bittu shashank7andr...@gmail.com wrote:
I found one interesting question
Given a string s , return the shortest substring that is
only occurring once.
Examples:
Have you tested your claim regarding overflow/underflow and proved it
is indeed a problem, or you just thought that it won't work? Using
two's complement, it should still work.
On Friday, June 10, 2011, Wladimir Tavares wladimir...@gmail.com wrote:
Swapping two variables without using a
Hi buddy,
nominate me as a group member
my id is: the.um...@gmail.com
On Mon, Jun 13, 2011 at 12:03 AM, shady sinv...@gmail.com wrote:
Vishwakarma deok...@gmail.com
Arpit Sood soodfi...@gmail.com
@kartik could have given your name had you read the post carefully.
Shady.
On Mon, Jun
+1
I really like this group ... but sometimes people get rude and
show prejudice attitude towards me. I hope the admin takes notice of one of
the comment posted above :)
On Mon, Jun 13, 2011 at 12:30 AM, Divye Kapoor divyekap...@gmail.comwrote:
While you're on this - could we have a policy
On Jun 13, 11:43 am, snehi jain snehijai...@gmail.com wrote:
hi,
we try to implement many programs using Recursion
and its said that this is better than iterative procedure.
if i am right then
i cant understand why is it so?
can anybody explain ...
and are there situations when
Traversal the suffix tree is enough.
All substrings from root to leaf (including at least 1 character of leaf
node) occur only once.
Choose the shortest among them.
On 2011-6-15 5:28, T3rminal wrote:
@bittu
How can u find the shortest substring from the tree in 0(n). Can u
please elaborate a
@akash:can u please explain your code...?
On Mon, Jun 13, 2011 at 2:27 AM, Divye Kapoor divyekap...@gmail.com wrote:
No extra memory except input buffer: O(n log n) time O(n) space (can't do
better than this).
I am not able to logincan u help me...
On Mon, Jun 13, 2011 at 12:17 AM, ADITYA KUMAR aditya...@gmail.com wrote:
http://www.freepuzzles.com
This is the best site for quality puzzles,
But solutions are not given...
so i request members ,try to solve these puzzles and post their solutions
Adding two huge no will cross the integer or what's its range will fall
under overflow categories same case goes to negative which fall under
underflow .. In both the case numbers will change..
For example no range is -10 to 10 so if x =5 and y=7 then addition will
produce the result -9 so u can
int a,c=5;
a=c++ + ++c + c++ + ++c;
printf(%d\n,a);
c=5;
a=c++ + ++c + c++;
printf(%d\n,a);
c=5;
a=++c + ++c;
printf(%d\n,a);
c=5;
a=++c + ++c + ++c;
printf(%d\n,a);
compiled with gcc and the outputs are
25
18
14
22
can anyone plz explain these outputs
--
You received this message because you
@t3rminal: k
On Wed, Jun 15, 2011 at 7:05 AM, Terence technic@gmail.com wrote:
Traversal the suffix tree is enough.
All substrings from root to leaf (including at least 1 character of leaf
node) occur only once.
Choose the shortest among them.
On 2011-6-15 5:28, T3rminal wrote:
Vas happening forum ??
On Mon, Jun 13, 2011 at 5:59 PM, Umer Farooq the.um...@gmail.com wrote:
+1
I really like this group ... but sometimes people get rude and
show prejudice attitude towards me. I hope the admin takes notice of one of
the comment posted above :)
On Mon, Jun 13, 2011 at
You can check the modified code at http://ideone.com/7NFTd and got AC
at spoj
Thanks
Rahul Singal
Computer Science Department
BITS PILANI
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Hi Sharad,
Just see the active members in the recent past and those who have done the
maximum post recently.
And add that to the moderator list.
We don't want many moderators here 2 active ones will do it.
I think one of them can be dave don't know his id.
On Wed, Jun 15, 2011 at 10:28 AM,
Google sequence points. The C Standard states that between the previous and
next sequence point an object shall have its stored value modified at most
once by the evaluation of an expression.
So, expressions like i++ + ++i can produces different results on different
compilers. Its not a standard
moderators, please ban leon.pan...@gmail.com
On Wed, Jun 15, 2011 at 1:00 AM, Leon Parker leon.pan...@gmail.com wrote:
Hello Associate,
Please go through the below requirement and let me know if you have any
consultants for the below position.
Job Title: Java Developer
Location:
@ Harshal, you are absolutely right. Again, this kind of code is
highly discouraged when used in real life projects. And there is no
need to go into details of how to evaluate such expressions, which are
not complying to standards.
On Wed, Jun 15, 2011 at 10:49 AM, Harshal hc4...@gmail.com wrote:
Nice Confusion... :)
Consider the following case
A[M] = {1,1,3,12};
B[N] = {1,2,12}
here again i think answer should be {1,1,12} , why are u binding one
occurrence of 1 in array A with one in B. Question is which elements of
first array is present in second array. so for this case A[0], A[1],
67 matches
Mail list logo