@kunal patil: You are correct.
the double linked list doent solve the this problem.
--
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/-/NWtqQndBbExyV1lK.
To post
recursive version of the code
void rev(char *beg, char *end)
{
if(beg=end)
rev(beg+1, end-1);
else
return ;
swap(beg,end);
}
On Wed, Jun 1, 2011 at 5:46 PM, saurabh singh saurab...@gmail.com wrote:
Tho a do while loop in place of the second
LION
On Thu, Jun 2, 2011 at 12:42 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*assemble riddle
*
*
*
**
*What king can you make if you take
the head of a lamb
the middle of a pig
the hind of a buffalo
and the tail of a dragon ?
*
*
*
*Update Your Answers at* : Click
how about this one?
Node* reverseBy2(Node* head){
Node* p1 = head;
if(p1 == NULL)
return NULL;
Node* p2 = p1-next;
if(p2 == NULL)
return head;
Node* nextHead = p2-next;
p2-next = p1;
p1-next = reverseBy2(nextHead);
return p2;
}
[?]
2011/6/1 Shivaji
i am thinking that the team with win point 4 will be the winner ..
is this wrong?
https://www.spoj.pl/problems/SBETS/
--
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
struct node *reverse(struct node *head, int k )
{
struct node *prev = NULL;
struct node *current = head;
struct node *next = NULL;
int count = 0;
while(current count k) {
next = current-next;
current-next = prev;
prev = current;
current = next;
count++;
}
/*** reverse remaining nodes
wouldn't it be skip list or a circular DLL
what if we have next as well as next-next pointers in every node. If the LL
is say a-bcd
if a-b is corrupted, a-c can be used to reach rest of the LL
if say b-c is corrupt,
a-c can be used to recover complete list...
is this better or skip list?
Best
I Think circular DLL should do...skip list is not required !!
On Thu, Jun 2, 2011 at 5:31 AM, Ashish Goel ashg...@gmail.com wrote:
wouldn't it be skip list or a circular DLL
what if we have next as well as next-next pointers in every node. If the
LL is say a-bcd
if a-b is corrupted, a-c can
your logic will fail in many cases as the runner up will also have 4
win but in 5 matches.on the other hand winner will have 4 out of
4 ;)
On Jun 2, 1:51 am, PRAMENDRA RATHi rathi prathi...@gmail.com wrote:
i am thinking that the team with win point 4 will be the winner ..
is this wrong?
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*Please reply at
the problem here is what if more than 1 pointers are corrupt?
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Thu, Jun 2, 2011 at 6:35 PM, Logic King crazy.logic.k...@gmail.comwrote:
I Think circular DLL should do...skip list is not required !!
what is the logic, kindly explain
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Sat, May 28, 2011 at 12:23 PM, Aakash Johari aakashj@gmail.comwrote:
Following code works for [A-Za-z], can be extended for whole character-set
:
#include
using bitmap, but extra memory not allowed?
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Thu, Jun 2, 2011 at 7:38 PM, Ashish Goel ashg...@gmail.com wrote:
what is the logic, kindly explain
Best Regards
Ashish Goel
Think positive and find
hmm...then skip list is surely a better option
On Thu, Jun 2, 2011 at 7:04 AM, Ashish Goel ashg...@gmail.com wrote:
the problem here is what if more than 1 pointers are corrupt?
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Thu, Jun 2,
int i=lenA-1;
int j=lenB-1;
while (j=0)
{
if (A[i] B[j]) {swap(A[i] ,B[j]); sort(A); }
j--;
}
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Sat, May 28, 2011 at 11:09 PM, ross jagadish1...@gmail.com wrote:
Hi all,
Given 2 sorted
Given a function to draw a circle with input paramters as co-ordinates of
centre of the circle and r is the radius of the circle.
How will you test this function, what will be additional non-functional
test cases
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
#include stdio.h
int main()
{
float f=0.0f;
int i;
for(i=0;i10;i++)
f = f + 0.1f;
if(f == 1.0f)
printf(f is 1.0 \n);
else
printf(f is NOT 1.0\n);
return 0;
}
--
You received this message because
f is NOT 1.0
On Thu, Jun 2, 2011 at 8:35 PM, Balaji S balaji.ceg...@gmail.com wrote:
#include stdio.h
int main()
{
float f=0.0f;
int i;
for(i=0;i10;i++)
f = f + 0.1f;
if(f == 1.0f)
printf(f is 1.0 \n);
else
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*Please reply at
You may use the following programming tricksto do the float
number comparison.
1) a == b = fabs(a - b) = eps
2) ab = b - a eps
3) a = b = b - a = -eps
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
#include stdio.h
int main()
{
int a=3, b = 5;
printf(a[Ya!Hello! how is this? %s\n], b[junk/super]);
printf(a[WHAT%c%c%c %c%c %c !\n], 1[this],
2[beauty],0[tool],0[is],3[sensitive],4[CC]);
return 0;
}
--
With Regards,
Balaji.S
--
You received this
Does it work??
On Thu, Jun 2, 2011 at 10:30 PM, Balaji S balaji.ceg...@gmail.com wrote:
#include stdio.h
int main()
{
int a=3, b = 5;
printf(a[Ya!Hello! how is this? %s\n], b[junk/super]);
printf(a[WHAT%c%c%c %c%c %c !\n], 1[this],
Output should be:
Hello! how is this? super
That is C
On Thu, Jun 2, 2011 at 10:38 AM, Anika Jain anika.jai...@gmail.com wrote:
Does it work??
On Thu, Jun 2, 2011 at 10:30 PM, Balaji S balaji.ceg...@gmail.com wrote:
#include stdio.h
int main()
{
int a=3, b = 5;
Output
Hello! how is this? super
That is C!
--
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
It was given that one or two extra variables are allowed. So I used a
variable instead for mapping.
It is simply mapping of each character in alphabet to a bit in the variable.
On Thu, Jun 2, 2011 at 7:10 AM, Ashish Goel ashg...@gmail.com wrote:
using bitmap, but extra memory not allowed?
what do they want to test by asking such a question!
On Thu, Jun 2, 2011 at 11:17 PM, Senthil S senthil2...@gmail.com wrote:
Output
Hello! how is this? super
That is C!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
Can someone please explain how is this working ??
On Thu, Jun 2, 2011 at 11:24 PM, Harshal hc4...@gmail.com wrote:
what do they want to test by asking such a question!
On Thu, Jun 2, 2011 at 11:17 PM, Senthil S senthil2...@gmail.com wrote:
Output
Hello! how is this? super
That is C!
how s that output obtained??
--
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
in c str[i] can be indexed using anthr notation i.e i[str] also
bt m nt getting hw hello! how is this gets printedsince its format
specifier i.e %s occurs aftr the string...
On Thu, Jun 2, 2011 at 11:40 PM, Balaji S balaji.ceg...@gmail.com wrote:
how s that output obtained??
--
@balaji :)
This is a question
But don tell this is a MS quesiton :P :P :P
On Thu, Jun 2, 2011 at 11:40 PM, Balaji S balaji.ceg...@gmail.com wrote:
how s that output obtained??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
Can you please tell What are we testing here ?.
I mean to ask what is the output of the function..
On Thu, Jun 2, 2011 at 7:49 PM, Ashish Goel ashg...@gmail.com wrote:
Given a function to draw a circle with input paramters as co-ordinates of
centre of the circle and r is the radius of the
Can any one explain the output of this...
i have a guess.
int a=3, b = 5;printf(a[Ya!Hello! how is this? %s\n],
b[junk/super]);
here a is 3 so it print the after 3 characters ie.*Hello! how is this?*.
and coming to b is 5 so it prints *super*.
this is my guess and i cant get the other
better than O(n2) algo
--
**With Regards
Deoki Nandan Vishwakarma
IITR MCA
Mathematics Department*
*
--
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
Ya!Hello! how is this? %s\n
is essentially a character array
3[Ya!Hello! how is this? %s\n] yields H.
3[Ya!Hello! how is this? %s\n] yields address of character array
beginning with H i.e address of array Hello! how is this? %s\n which forms
the format string in printf.
Thus Hello! how is this
same as:
int a[5] = { 1, 2, 3, 4, 5 };
int i = 3;
printf(%d, i[a]);
in question asked,
a will set ptr to 3rd position ie. at H and will print whole string
b will set ptr to 5th position ie. @ s it also print whole string.
But in 2nd printf , string will start from 3rd position ie. T and will
ya go it.
thanks for the response...
--
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/-/aVY0WGJnYUUzSllK.
To post to this group, send email to
some test cases:
1) r is -ive
2) r is 0
3) test center in all four quadrants.
4) r is some very large number
On Thu, Jun 2, 2011 at 11:47 PM, Sachin Jain sachinjain...@gmail.comwrote:
Can you please tell What are we testing here ?.
I mean to ask what is the output of the function..
On
Given 2 linked lists, determine whether they intersect or not?
(question is not find the point of intersection, which i am sure can
be done by computing the lengths of both lists (len1 and len2)
and traversing the larger list by |len1 - len2| and traversing
subsequently
until 2 ptrs meet.
I am
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
* Please reply at
@above : thanks got it :)
--
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,
Hi
Mere removal is enough ? Shifting not necessary ?
If yes, then
we can have something like this. But let me know if this sounds ok and any
further improvements.
int chars = new int[256];
int values = new int[10]; // say 10 chars
for(i = 0; i 10; i++) {
int charVal = toascii(values[i]);
take X-OR of all the elements.the one which has no duplicate will be
left and rest all will be reduced to zero.
--
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
sorry the above algo will not work in case we have more than one single
element
--
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
@Anurag: XOR wont work here, 1 element is repeated, not 1 element is unique.
Read the question again.
Keep inserting elements in a BST and break once you find the same element.
O(nlogn)
On Fri, Jun 3, 2011 at 12:38 AM, Anurag Narain anuragnar...@gmail.comwrote:
take X-OR of all the
If use of hash table is allowed. then it can be done in o(n)
On Fri, Jun 3, 2011 at 12:41 AM, Harshal hc4...@gmail.com wrote:
@Anurag: XOR wont work here, 1 element is repeated, not 1 element is unique.
Read the question again.
Keep inserting elements in a BST and break once you find the same
Hi
Inserting into BST and break on same element will detect duplicates.
But in any case, this is still O(2n) ? - once for inserting them in to the
tree
and another for the inorder read.
Correct me if wrong.
Rgds
Supraja J
On Thu, Jun 2, 2011 at 1:11 PM, Harshal hc4...@gmail.com wrote:
you can check if the element to be inserted next is same as the node value
while inserting itself. Why to do a separate inorder traversal..
On Fri, Jun 3, 2011 at 12:56 AM, Supraja Jayakumar suprajasank...@gmail.com
wrote:
Hi
Inserting into BST and break on same element will detect
But I think the solution required is O(n) (one pass). So, O(nlogn) is not
what the author wants anyway. Hashing is an option but we dont know the
range of the elements in the array. So, in case when all keys hash into the
same place, the worst case is still O(n^2).
suppose our hash function is
Please consider the following code
// dequeue.cpp : Defines the entry point for the console application.
//
#include stdafx.h
#include iostream
#include deque
#include algorithm
using namespace std;
struct print
{
void operator() (int i)
{
cout i;
}
}myprint;
int
Hi
I think multi hash table will solve this problem.
Thanks
Supraja J
On Thu, Jun 2, 2011 at 1:37 PM, Harshal hc4...@gmail.com wrote:
But I think the solution required is O(n) (one pass). So, O(nlogn) is not
what the author wants anyway. Hashing is an option but we dont know the
range of
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
* Please reply at
Traverse the 2 linked lists. Check if the node just before NULL is the
same in both the linked lists. If it is then there is an
intersection(return 1), otherwise not (return 0). The logic is that
whenever 2 linked lists intersect, all the nodes starting from the
point of intersection to the end of
Use of Computational Intelligence / Artificial Intelligence/
Artificial Life To Solve Millennium Prize Mathematical Problems.
If Computational Intelligence / Artificial Intelligence / Artificial
Life could be used to solve the Millennium Prize Mathematical Problems
please send me feedback on
Hi,
Can someone recommend me good resources (books/websites etc.) for
design interview questions.
Thanks
--
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
You need parentheses around int: sizeof(int)
Don
On Jun 2, 2:41 pm, asit lipu...@gmail.com wrote:
Please consider the following code
// dequeue.cpp : Defines the entry point for the console application.
//
#include stdafx.h
#include iostream
#include deque
#include algorithm
using
Are we drawing a circle on the screen?
In addition to Harshal's suggestions, try putting the center off the
screen, but have part of the circle on the screen:
x=-10
y=-20
r=100
Don
On Jun 2, 9:19 am, Ashish Goel ashg...@gmail.com wrote:
Given a function to draw a circle with input paramters
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
* Please reply at
Hi
Design patterns by Erich Gamma ?
Supraja J
On Thu, Jun 2, 2011 at 3:02 PM, Sachin Agarwal sachinagarwa...@gmail.comwrote:
Hi,
Can someone recommend me good resources (books/websites etc.) for
design interview questions.
Thanks
--
You received this message because you are subscribed
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
* Please reply at
There are basically two ways of calling sizeof:
sizeof unary-expression
sizeof ( type-name )
Parentheses is not bad, when you are not sure whether to add it or
not, just add it.
For your case, you should put parentheses around type int, and also
you can leave arr without parentheses. In
while all this is fine, the basic test case that each point on the circle is
at a distance of r from the centre becomes first functional test case.
what would be non-functional test cases eg. to check on different
dpi/screen sizes etc
Best Regards
Ashish Goel
Think positive and find fuel in
@Sanjay ahuja
yes ans is required in O(n)
how it can be done by hashing?
On Fri, Jun 3, 2011 at 1:19 AM, Supraja Jayakumar
suprajasank...@gmail.comwrote:
Hi
I think multi hash table will solve this problem.
Thanks
Supraja J
On Thu, Jun 2, 2011 at 1:37 PM, Harshal hc4...@gmail.com wrote:
you can use Java HashTable/HashMap to store key value pair, where Key
being the element stored in array and Value being the index of the
element. Any duplicate insert on key will replace the value of that
Key. After finishing all elements retrieve all Key, value pair stored
in HashMap.
Let me
question is in c++
On Fri, Jun 3, 2011 at 7:48 AM, sanjay ahuja sanjayahuja.i...@gmail.comwrote:
you can use Java HashTable/HashMap to store key value pair, where Key
being the element stored in array and Value being the index of the
element. Any duplicate insert on key will replace the value
@sohail panzer:
PEOPLE LIKE YOU POLLUTE ALGOGEEKS.
JUST SHUT UP AND STOP SPAMMING THIS GROUP!!
On Jun 3, 1:36 am, sohail panzer sohail.panz...@gmail.com wrote:
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT
Hi Ankit,
Thats was Nice solution ! :)
In case we maintain a pointer to the last node in the linked list,
then it is O(1) in time right?
On Jun 3, 12:00 am, ankit sambyal ankitsamb...@gmail.com wrote:
Traverse the 2 linked lists. Check if the node just before NULL is the
same in both the
yes panzer dude we would love to work in miami. But for some of us this is
high time now and we are here to discuss about algos/DS. So kindly get lost
from this group. Where is admin!!!
On Fri, Jun 3, 2011 at 8:49 AM, ross jagadish1...@gmail.com wrote:
@sohail panzer:
PEOPLE LIKE YOU POLLUTE
@Harshal: Dude, this panzel should be banned! Every time his spam
posts top the list!
On Jun 3, 7:35 am, Harshal hc4...@gmail.com wrote:
yes panzer dude we would love to work in miami. But for some of us this is
high time now and we are here to discuss about algos/DS. So kindly get lost
from
Hi ankit,
I am just asking my doubt, i am not sure...
if linked list say l1 is = 2 3 4 5
linked list l2 is = 1 3 7 9
now we can also say that l1 and l2 intersect at 3.
so in this case wouldn't ur soln will fail?
or this type of intersection that i am talking about is not possible?
On Thu, Jun
How can that be unless 3 has two next nodes?
--
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
L1 L2
1 5
27
3
94
Is this situation not possible?
On Thu, Jun 2, 2011 at 10:23 PM, anand karthik
anandkarthik@gmail.comwrote:
How can that be unless 3 has two next nodes?
--
You received this message because you are
each node in a linked list has one next pointer how can node 3 point to 9
4.
On Fri, Jun 3, 2011 at 10:56 AM, Arpit Mittal mrmittalro...@gmail.comwrote:
L1 L2
1 5
27
3
94
Is this situation not possible?
On Thu, Jun 2,
Hi Arpit,
I dont think this sort of intersection is possible..
A linked list has only one next pointer and it can point to single
node only.
In the counter example you gave, the next ptr of node 3 points to two
nodes.
So, such a case does not arise.
On Jun 3, 9:26 am, Arpit Mittal
@Arpit : By intersection of the 2 linked lists, we mean that the
pointers to a node are common. It does not mean that if 2 nodes have
the same data value, they intersect.
Also a node can have only 1 next node, not 2. So, in the example
provided by u, how can node having data value 3 point to 2
74 matches
Mail list logo