@Victor : Counting sort uses extra data structures to maintain the count and
the output array , so it is not viable I think ?? what say ??
On Sat, Jul 23, 2011 at 11:04 AM, Victor Manuel Grijalva Altamirano <
kavic1.mar...@gmail.com> wrote:
> Use a type of counting sort with ascii
>
>
> 2011/7/22
Given a valid range sort keys, the linked list can be sorted in O9n) time
using counting sort which takes O(n+k) comparisons to sort the list of K
elements .
On Sat, Jul 23, 2011 at 9:58 AM, Ankur Khurana wrote:
> 10^9->-10^9 -> 8-> 7- > NULL . It wont help in this case...
>
>
> On Sat, Jul 2
can anyone suggest interview questions for chronus corp...i have
interview on august 1st...
--
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
ya, you are right, but it returns -1 when it reaches the end of file.
On Sat, Jul 23, 2011 at 9:15 AM, arun kumar wrote:
> @shady:i have a doubt. scanf returns number of succesfully read words.
> how come it will return -1?
>
> On Sat, Jul 23, 2011 at 12:17 AM, geek forgeek
> wrote:
> > @shady
@ popli: plz change ur email id..placement session will start soon.
On Jul 22, 8:32 pm, Gaurav Popli wrote:
> an O(n) soln
> traveres the array...as you receive odd number put that index in
> queuewhen received an even numb check if queue is empty or
> not...if queue is empty the do nothing
Use a type of counting sort with ascii
2011/7/22 SkRiPt KiDdIe
> Use 8 mask integers or 4 LL to cover the complete ascii range.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegro
Use 8 mask integers or 4 LL to cover the complete ascii range.
--
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.
Use Quick sort to sort the characters of a string (qsort is inplace sorting
) then check for consecutive characters in the array, if they are same then
the string is not unique else unique .(use builtin qsort in C .) No
additional data structure is used ... What do u think of this guys ??
On Sat,
what if cahrs are in ascii code range and not just characters. Any solution
for that ?
On Sat, Jul 23, 2011 at 9:57 AM, keyan karthi wrote:
> u can use an integer as a "bit mask" to do this... by setting the
> -'a' th bit, and checking the same..
>
>
> On Sat, Jul 23, 2011 at 9:52 AM, Re
10^9->-10^9 -> 8-> 7- > NULL . It wont help in this case...
On Sat, Jul 23, 2011 at 9:55 AM, keyan karthi wrote:
> counting sort ll help to some extent... find the min and max element O(n)
> now u just need an array of size "max-min" to store the values then
> just traverse the list and
u can use an integer as a "bit mask" to do this... by setting the
-'a' th bit, and checking the same..
On Sat, Jul 23, 2011 at 9:52 AM, Reynald wrote:
> Implement an algorithm to determine if a string has all unique
> characters. What if you can not use additional data structures?
>
> -
counting sort ll help to some extent... find the min and max element O(n)
now u just need an array of size "max-min" to store the values then
just traverse the list and while updating u do value+min... still it is not
suitable if the magnitude is high.
On Sat, Jul 23, 2011 at 9:45 AM, Ank
Implement an algorithm to determine if a string has all unique
characters. What if you can not use additional data structures?
--
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
n logn merge sort.count sort only when range is known.
On Sat, Jul 23, 2011 at 1:35 AM, sunny agrawal wrote:
> Cannot be done in O(N) if elements of list can take any value because then
> counting sort wont help
>
> On Sat, Jul 23, 2011 at 1:24 AM, Pankaj wrote:
>
>> For link
@shady:i have a doubt. scanf returns number of succesfully read words.
how come it will return -1?
On Sat, Jul 23, 2011 at 12:17 AM, geek forgeek wrote:
> @shady and @varun ...
> i hav got it
> thanx both of u :)
>
> On Fri, Jul 22, 2011 at 11:31 AM, shady wrote:
>>
>> @aditi the problem is sca
one can use recursion for this
int gcd(int u,int v)
{
if(u==0) return v;
else if(v==0) return u;
else if(u%2==0&&v%2==0) return 2*gcd(u/2,v/2);
else if(u%2==0&&v%2!=0) return gcd(u/2,v);
else if(v%2==0&&u%2!=0) return gcd(u,v/2);
else if(u>v) return gcd((u-v)/2),v);
else if(u<=v)
return
check
http://tech-queries.blogspot.com/2009/05/max-possible-sum-of-non-consecutive.html
On Wed, Jul 20, 2011 at 11:58 PM, sunny agrawal wrote:
> Just take an extra array that will keep track of the values from which we
> get the best in solution to that thread.
>
>
>
> On Thu, Jul 21, 2011 at 8:5
Please check this program in java and add your comments if you feel anything
wrong
http://rajeevprasanna.blogspot.com/2011/07/add-two-numbers-stored-in-linked-lists.html
2011/7/18 η!Ƭ!گђ
> #include
> #include
> #include
>
> struct node
> {
> char ch;
> struct node *ptr;
> }*tp,*sp;
>
> int c
Yes, this is a simple DP problem:
#include
#include
#define MAX 10
int main()
{
int n, a[100], dp[100];
while(scanf("%d", &n) == 1)
{
for(int i = 0; i < n; i++){
scanf("%d", &a[i]);
dp[i] = MAX;
}
dp[n - 1] = 0;
for(int i
You are given an array with some values..traverse the array according to the
rule that if a[i]=x then you can jump max up to x steps.. (if a[i]=0 then
you can't move any forward)
find the least number of steps required to traverse the array ...
EG:a[]=1 3 5 8 9 7 8 0 2 this requires 3 steps to tra
what DS u used in the 3rd question ??
On Fri, Jul 22, 2011 at 8:22 PM, siva viknesh wrote:
> @ankur.. as u said i m posting today :) :)
>
> 10 questions c output, one compiler based(CFG) ,one OS
> based (when reading internally it was just a simple percentage
> calculation que
Algo for gcd(u,v) :
gcd(0,v)=v and gcd(u,0)=u;
gcd(u,v)=2*(gcd(u/2,v/2)) if u and v are multiples of 2
gcd(u,v)=gcd(u/2 ,v) if u is a multiple of 2 and v is not
gcd(u,v)=gcd(u,v/2) if v is a multiple of 2 and u is not
gcd(u,v)= gcd((u-v)/2,v) if u and v are not multiples of 2 and u>=v
gcd(u,v)=gcd(
O(n) solution:
odd_index=-1;
even_index=-1;
//now find first odd no.'s index
for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.
Cannot be done in O(N) if elements of list can take any value because then
counting sort wont help
On Sat, Jul 23, 2011 at 1:24 AM, Pankaj wrote:
> For linklist? How
>
>
> On Sat, Jul 23, 2011 at 1:23 AM, Kamakshii Aggarwal > wrote:
>
>> use counting sort..
>>
>>
>> On Sat, Jul 23, 2011 at 1:22
actually its a work around...first traverse the list and store it in an
array..
sort the array in o(n)
then replace the content of the linked list using the values in the array
On Sat, Jul 23, 2011 at 1:24 AM, Pankaj wrote:
> For linklist? How
>
>
> On Sat, Jul 23, 2011 at 1:23 AM, Kamakshii Ag
For linklist? How
On Sat, Jul 23, 2011 at 1:23 AM, Kamakshii Aggarwal
wrote:
> use counting sort..
>
>
> On Sat, Jul 23, 2011 at 1:22 AM, rShetty wrote:
>
>> How to sort Linked lists in O(n) time ??
>> Give the algorithm or the explanation or clue to tackle the problem
>>
>> --
>> You received t
use counting sort..
On Sat, Jul 23, 2011 at 1:22 AM, rShetty wrote:
> How to sort Linked lists in O(n) time ??
> Give the algorithm or the explanation or clue to tackle the problem
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To
How to sort Linked lists in O(n) time ??
Give the algorithm or the explanation or clue to tackle the problem
--
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
That can never be done in constant time :).
If you can find one solution, then please let us know.
On Sat, Jul 23, 2011 at 1:13 AM, rShetty wrote:
> SO what about If my Linked list is a sorted list and the new node I
> wanna insert must maintain that sorted nature , So can then be the
> insertio
i think for sorted order. u hv to traverse the list.it cant be in const time
On Sat, Jul 23, 2011 at 1:13 AM, rShetty wrote:
> SO what about If my Linked list is a sorted list and the new node I
> wanna insert must maintain that sorted nature , So can then be the
> insertion of a node be done in
SO what about If my Linked list is a sorted list and the new node I
wanna insert must maintain that sorted nature , So can then be the
insertion of a node be done in constant time without traversing the
list ??
On Jul 23, 12:26 am, Pankaj wrote:
> If you know circular list, what is avoiding you f
oh sorry...i didnt see.yeah..you are rightthanks..
On Sat, Jul 23, 2011 at 1:06 AM, sunny agrawal wrote:
> But that will save only 50% of the prisoners...as compare to 99.5% in
> that of even Odd case
> Read that post carefully
>
> On Sat, Jul 23, 2011 at 1:04 AM, Gaurav Popli wrote:
Well a "double" pointer (A more accurate term is multidimensional pointer,
in this case a two dimensional pointer) is basically a pointer to an array
of pointers.
So, int **ptr basically says, ptr is a pointer to an array of pointers. And
you can allocate memory to each of these pointers individua
So we should maintain a tail pointer and add nodes next to the tail
pointer ??? Right ???
On Jul 23, 12:26 am, Pankaj wrote:
> If you know circular list, what is avoiding you from maintaining a tail
> pointer.
> You just need to tweak insert and delete function a little bit for corner
> cases.
>
But that will save only 50% of the prisoners...as compare to 99.5% in
that of even Odd case
Read that post carefully
On Sat, Jul 23, 2011 at 1:04 AM, Gaurav Popli wrote:
> or we cud make more easy for prisoners...instead of counting whether
> even or notthe person at the back can say the
int **x;
x = new int*[n];
for (int i = 0; i < n; i++){
x[i] = new int[m];
This algorithm will create a m*n matrix.
x= new int*[n] is same as allocating array of n which will be of (Int *)
type. It will store the address of n arrays of m size.
x[i]= new int[m] here we are allocating an array of m i
or we cud make more easy for prisoners...instead of counting whether
even or notthe person at the back can say the color of the hat
which the prisoner in the immediate front is wearing.
by this atleast 50% prisoners will be relaesed/.
it will all depend on thr cooperation ;)
On Fri, Ju
@rakib:can u please explain ur answer
On Sat, Jul 23, 2011 at 12:48 AM, Pankaj wrote:
> https://ideone.com/tr3Q7
>
>
> On Sat, Jul 23, 2011 at 12:42 AM, Pankaj wrote:
>
>> double **p= (double **) malloc(sizeof(double *));
>>
>>
>> On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal
>> wrote:
>>
>
If you know circular list, what is avoiding you from maintaining a tail
pointer.
You just need to tweak insert and delete function a little bit for corner
cases.
On Sat, Jul 23, 2011 at 12:50 AM, rShetty wrote:
> Algorithm Please ... Thank You
>
> On Jul 23, 12:17 am, vaibhav shukla wrote:
> >
I think when the mismatch of the format specifier and the variable occurs ,
the compiler generates random number output as, some garbage I suppose .
On Sat, Jul 23, 2011 at 12:30 AM, geek forgeek wrote:
> #include
> void main()
> {
> int x;
> float t;
> scanf("%f",&t);
> printf("
Algorithm Please ... Thank You
On Jul 23, 12:17 am, vaibhav shukla wrote:
> maintain just a tail pointer
>
> On Sat, Jul 23, 2011 at 12:45 AM, rShetty wrote:
> > Come Up with an Algorithm to implement the insertion of a node in
> > circular linked list without actually traversing the list ?
@nicks -- ur code for 1st problem is giving me 1 not -1 on gcc..which
compiler are you using
On Fri, Jul 22, 2011 at 11:58 AM, sumit wrote:
> +1 to t3rminal
>
>
> On Jun 12, 11:38 pm, T3rminal wrote:
> > @all
> > Stop guessing and making your own standards. C standards haven't
> > defined anyth
https://ideone.com/tr3Q7
On Sat, Jul 23, 2011 at 12:42 AM, Pankaj wrote:
> double **p= (double **) malloc(sizeof(double *));
>
>
> On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal
> wrote:
>
>> double pointer mean like **p
>>
>> hoe to allocate memory for this
>>
>> --
>> You received this
maintain just a tail pointer
On Sat, Jul 23, 2011 at 12:45 AM, rShetty wrote:
> Come Up with an Algorithm to implement the insertion of a node in
> circular linked list without actually traversing the list ?
>
> --
> You received this message because you are subscribed to the Google Groups
>
Come Up with an Algorithm to implement the insertion of a node in
circular linked list without actually traversing the list ?
--
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
double **p= (double **) malloc(sizeof(double *));
On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal wrote:
> double pointer mean like **p
>
> hoe to allocate memory for this
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post
int **x;
x = new int*[n];
for (int i = 0; i < n; i++){
x[i] = new int[m];
}
On Sat, Jul 23, 2011 at 1:10 AM, Bhavesh agrawal wrote:
> double pointer mean like **p
>
> hoe to allocate memory for this
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorith
double pointer mean like **p
hoe to allocate memory for this
--
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+unsubs
oh sorry for above soln...it will require many passes and hence inefficient...
On Fri, Jul 22, 2011 at 9:02 PM, Gaurav Popli wrote:
> an O(n) soln
> traveres the array...as you receive odd number put that index in
> queuewhen received an even numb check if queue is empty or
> not...if queue i
Just like you do for int *
int *p=(int *) malloc(sizeof(int));
double *ptr_lf = (double *) malloc(sizeof(double));
On Sat, Jul 23, 2011 at 12:32 AM, hurtlocker wrote:
> how to allocate memory for a double pointer ..??
>
> --
> You received this message because you are subscribed to the Google Gro
how to allocate memory for a double pointer ..??
--
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...@googlegroup
#include
void main()
{
int x;
float t;
scanf("%f",&t);
printf("%f\n",t);
x=90;
printf("%f\n",x);
{
x=1;
printf("%f\n",x);
{
x=30;
printf("%f\n",x);
}
printf("%f\n",x);
}
x==9;
printf("%f\
+1 to t3rminal
On Jun 12, 11:38 pm, T3rminal wrote:
> @all
> Stop guessing and making your own standards. C standards haven't
> defined anything (though in gcc arguments are processed from left to
> right) about processing arguments in a function call. And sentence
> like "assgnment to a preincr
@shady and @varun ...
i hav got it
thanx both of u :)
On Fri, Jul 22, 2011 at 11:31 AM, shady wrote:
> @aditi the problem is scanf returns -1(EOF value) when it encounters the
> end of file, and inspite of comparing the return value of scanf he is
> comparing value of character 'a' which is not
@aditi the problem is scanf returns -1(EOF value) when it encounters the end
of file, and inspite of comparing the return value of scanf he is comparing
value of character 'a' which is not correct
therefore the for loop should be like this :
for(int t=scanf("%c",&a);t!=
@script kiddle
y u r rght ...i can smell too.. :P
On Fri, Jul 22, 2011 at 11:52 PM, varun pahwa wrote:
> For breaking the first loop after the input gives EOF.
> u can write it as.
>
> for(;~scanf("%c",&a); )
>
>
> On Fri, Jul 22, 2011 at 11:43 PM, LALIT SHARMA wrote:
>
>> No, actually , a i
For breaking the first loop after the input gives EOF.
u can write it as.
for(;~scanf("%c",&a); )
On Fri, Jul 22, 2011 at 11:43 PM, LALIT SHARMA wrote:
> No, actually , a is defined as char ... and comparing char with EOF ,,
> makes it go in infinte loop...as it never returns false.
>
> correct
I smell something BONe - Y :P
--
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 op
No, actually , a is defined as char ... and comparing char with EOF ,, makes
it go in infinte loop...as it never returns false.
correct me if i am wrong...
On Fri, Jul 22, 2011 at 11:41 PM, aditi garg wrote:
> @shady. so in this case we shud use a!=-1 as the condition??
>
>
> On Fri, Jul 22, 201
@shady. so in this case we shud use a!=-1 as the condition??
On Fri, Jul 22, 2011 at 11:37 PM, shady wrote:
> you are scanning from stdin therefore it is not coming out of first for
> loop... because your terminating condition is for EOF, which is -1( scanf
> returns -1 ) at the end.
>
>
> On Fr
you are scanning from stdin therefore it is not coming out of first for
loop... because your terminating condition is for EOF, which is -1( scanf
returns -1 ) at the end.
On Fri, Jul 22, 2011 at 11:34 PM, shady wrote:
> well you didn't mention the question, directly posted the code with no
> hea
well you didn't mention the question, directly posted the code with no
head-tail... wait will answer, it is not coming out of first loop
On Fri, Jul 22, 2011 at 11:26 PM, geek forgeek wrote:
> @shady this is nt a joke..
> sorry if i am asking too stupid question
> i m getting an infinite loop her
I think Aditi's solution is correct. I was doing the same thing using XOR
function... So basically I was saying to use XOR and interviewer was asking
for something better... I could not find this solution...
Thanks Aditi.
Thanks & Regards
Vishal Jain
MNo: +91-9540611889
Tweet @jainvis
Blog @ jain
@shady this is nt a joke..
sorry if i am asking too stupid question
i m getting an infinite loop here.
not getting how?
On Fri, Jul 22, 2011 at 10:40 AM, shady wrote:
> what kind of joke is this ?
>
> On Fri, Jul 22, 2011 at 11:02 PM, geek forgeek wrote:
>
>> #include
>> main()
>> {
>> FILE
what kind of joke is this ?
On Fri, Jul 22, 2011 at 11:02 PM, geek forgeek wrote:
> #include
> main()
> {
> FILE *fp;
> char a;
> fp=fopen("old.out","w");
> if(fp==0)
> printf("File opening error");
> else
> {
> for(scanf("%c",&a);a!=EOF;scanf("%c",&a))
>
#include
main()
{
FILE *fp;
char a;
fp=fopen("old.out","w");
if(fp==0)
printf("File opening error");
else
{
for(scanf("%c",&a);a!=EOF;scanf("%c",&a))
fprintf(fp,"%c",a);
fclose(fp);
fp=fopen("old.out","r");
while(!feof(fp))
thank u:)
--
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 this gro
how are you gonna do it if the originl strng contains repeated letters ...
On Fri, Jul 22, 2011 at 3:33 PM, shady wrote:
> what algorithm, print it subsequently
> is there any ?
>
>
> On Fri, Jul 22, 2011 at 3:24 PM, DeeJJ..! wrote:
>
>> @sunny...yaa..but can u just describe the algorithm..:
I think this can be answered like dis...
let us say that the persons have decided amongst themselves that if the the
number of people wearing white in front of dem is even he wud say white and
if odd he wud say black
Now suppose the 100th person counts the number of hats and finds it to be
even
both intern and interview.
all 10 ques were MCQ type
os based :
1. u ve a disk , 1 represents a 'valid read' (I forgot d exact
term!!!) and 0 represents 'invalid read' gn. a hexadecimal string
DFE00454AB ... find the nearest percentage of valid read?
2. gn. a CFG
s->AB
A->a|BaB
B->bb
could some1 plz post the xplainations ...
On Fri, Jul 22, 2011 at 8:04 PM, Pankaj wrote:
> Chetan,
>
> No. How could you relate this problem with that? Do you find something
> similar?
>
> ~
> Pankaj
>
>
> On Fri, Jul 22, 2011 at 8:01 PM, chetan kapoor
> wrote:
>
>> josehus problem???
>>
>>
>>
thnx ...
:D
On Fri, Jul 22, 2011 at 9:19 PM, sagar pareek wrote:
> gr8 shubham
>
> On Fri, Jul 22, 2011 at 1:42 PM, Shubham Maheshwari > wrote:
>
>> x = 0;
>> while( n ){
>> x <<= 1;
>> x = x | ( n & 1);
>> n >>= 1;
>> }
>>
>> return x;
>>
>> On Fri, Jul 22, 2011 at 1:31 PM, Puneet Gautam
>> w
@siva viknesh:it would be of great help if u post the questions that u
remember...(in that 10 questions)...
with regards
naveen
--
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.
thanks
its almost same :)
i was hoping for a diff answer (if exists)
On Fri, Jul 22, 2011 at 4:25 PM, Rajeev Kumar wrote:
> Please check this : http://www.techinterview.org/post/526313890/bad-king
>
> On Tue, Jul 19, 2011 at 8:43 PM, sagar pareek wrote:
>
>> hey guys pls tell any other better so
Thanx for pointitn out the case :) Hope dis wil wrk.
https://ideone.com/0LNkW
On , Pankaj wrote:
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwzzyyzzabc
output:
Length of largest unique substring : 51
Sorry it gt posted thrice.
On Jul 22, 7:50 pm, vaibhavmitta...@gmail.com wrote
gr8 shubham
On Fri, Jul 22, 2011 at 1:42 PM, Shubham Maheshwari
wrote:
> x = 0;
> while( n ){
> x <<= 1;
> x = x | ( n & 1);
> n >>= 1;
> }
>
> return x;
>
> On Fri, Jul 22, 2011 at 1:31 PM, Puneet Gautam wrote:
>
>> sorry guys.. dont check the above siolution.. its wrong...!!!
>> misread it..
>>
an O(n) soln
traveres the array...as you receive odd number put that index in
queuewhen received an even numb check if queue is empty or
not...if queue is empty the do nothing else swap with the head of the
queue
hope it worksit also maintains the stability of aarray...
On Fri, Jul 22
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwzzyyzzabc
output:
Length of largest unique substring : 51
Sorry it gt posted thrice.
>
> On Jul 22, 7:50 pm, vaibhavmitta...@gmail.com wrote:
> > https://ideone.com/kzo2L
> >
> > Regards
> > Vaibhav Mittal
> > Computer Science
> > Netaji Subhas Inst
post the 10 questions plz
On Fri, Jul 22, 2011 at 8:29 PM, shady wrote:
> what was it ? job interview questions or intern ?
>
> gcd can always be found in O(log(larger number)) , sorry, couldnt
> understand the complexity in that ?
>
>
> On Fri, Jul 22, 2011 at 8:22 PM, siva viknesh wrote:
>
>>
what was it ? job interview questions or intern ?
gcd can always be found in O(log(larger number)) , sorry, couldnt understand
the complexity in that ?
On Fri, Jul 22, 2011 at 8:22 PM, siva viknesh wrote:
> @ankur.. as u said i m posting today :) :)
>
> 10 questions c output,
Sorry it gt posted thrice.
On Jul 22, 7:50 pm, vaibhavmitta...@gmail.com wrote:
> https://ideone.com/kzo2L
>
> Regards
> Vaibhav Mittal
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
> On , Pankaj wrote:
>
>
>
>
>
>
>
> > Vaibhav, Ok write your code and paste on ideone. It
@ankur.. as u said i m posting today :) :)
10 questions c output, one compiler based(CFG) ,one OS
based (when reading internally it was just a simple percentage
calculation question)..
+3 for correct ans..
-2 for wrong ans...Damn it.. i dint notice d negative marking and
a
so many times such questions have come... behavior is entirely compiler
dependent
if you are preparing for interviews then believe me no one in the whole
world will ask such questions to you. there's no point discussing it
On Fri, Jul 22, 2011 at 8:15 PM, Gaurav Popli wrote:
> may be im
https://ideone.com/kzo2L
Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj wrote:
Vaibhav, Ok write your code and paste on ideone. It should be easy and
quick to code :)
On Fri, Jul 22, 2011 at 7:59 PM, vaibhavmitta...@gmail.com> wrote:
U
https://ideone.com/kzo2L
Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj wrote:
Vaibhav, Ok write your code and paste on ideone. It should be easy and
quick to code :)
On Fri, Jul 22, 2011 at 7:59 PM, vaibhavmitta...@gmail.com> wrote:
U
https://ideone.com/kzo2L
Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj wrote:
Vaibhav, Ok write your code and paste on ideone. It should be easy and
quick to code :)
On Fri, Jul 22, 2011 at 7:59 PM, vaibhavmitta...@gmail.com> wrote:
U
may be im wrongbut i read it somewhere about it...the arguments of
a function are evaluated in a associativity that is compiler
dependent...
for ex...
printf("%d %d %d" ,fun1(),fun2(),fun3());
the order in which functions are evaluated are compiler dependent
On Fri, Jul 22, 2011 at 7:2
Chetan,
No. How could you relate this problem with that? Do you find something
similar?
~
Pankaj
On Fri, Jul 22, 2011 at 8:01 PM, chetan kapoor wrote:
> josehus problem???
>
>
> On Fri, Jul 22, 2011 at 7:57 PM, Pankaj wrote:
>
>> Skipp Riddle,
>> Yes.
>> 100th prisoner will risk his life. Simi
Vaibhav,
Ok write your code and paste on ideone. It should be easy and quick to code
:)
On Fri, Jul 22, 2011 at 7:59 PM, wrote:
> U hv got my algo completely wrong. Gimme a smaller test case so that i may
> wrk it out fr u. This one is freakingly large :P.
>
>
> Regards
> Vaibhav Mittal
> Compu
josehus problem???
On Fri, Jul 22, 2011 at 7:57 PM, Pankaj wrote:
> Skipp Riddle,
> Yes.
> 100th prisoner will risk his life. Similar puzzle was discuss recently.
> Does anyone remember the name or thread?
>
>
> ~
> Pankaj
>
>
> On Fri, Jul 22, 2011 at 7:55 PM, SkRiPt KiDdIe wrote:
>
>> Worst ca
*abcdea*ifjlbmnodpq
For this once you encounter a at 6th position, You can update your max.
Now You will have to do following operation.
First clear all the hash.
2. You now can not start from 6th position. You will have to do back and
start from 2 position that is b.
Right?
What is the maximum un
U hv got my algo completely wrong. Gimme a smaller test case so that i may
wrk it out fr u. This one is freakingly large :P.
Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj wrote:
abcdeaifjlbmnodpq
For this once you encounter a at 6th position
Skipp Riddle,
Yes.
100th prisoner will risk his life. Similar puzzle was discuss recently. Does
anyone remember the name or thread?
~
Pankaj
On Fri, Jul 22, 2011 at 7:55 PM, SkRiPt KiDdIe wrote:
> Worst case 99 get released.
> Is that correct..?
>
> --
> You received this message because you a
Worst case 99 get released.
Is that correct..?
--
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.
Have a look again. I traverse the string just once performing updation on
variables low, high, max. I assume array operations to be O(1) (which they
are). OVerall complexity is O(n).Once I hit a duplicate i change my low,
high and A accordingly and move forward.
Regards
Vaibhav Mittal
Compu
In my latest interview I encountered the following puzzle.
There are 100 prisoners in the prison. All of them have either black or
white cap.
Jailer has asked them to stand in the queue such that nth guy can see caps
of all the guys standing ahead of him, but he can not see his own cap.
It means
Hi All,
In my last interview(given few months back), I was asked the following
puzzle..
http://goo.gl/jrnpc
Could you please tell me the solution for the same?
Thanks & Regards
Vishal Jain
MNo: +91-9540611889
Tweet @jainvis
Blog @ jainvish.blogspot.com
Success taste better when target achieved
@kunal patil ur right, i forgot to mention k=2.
refer http://www.exploringbinary.com/powers-of-two-in-the-josephus-problem/
surender
On Fri, Jul 22, 2011 at 7:21 PM, Kunal Patil wrote:
> @surender: I assume you want to give general solution to Josephus problem
> in which we shoot every kth per
Vaibhav
What do you think the complexity of your algo is. And once you hit an
duplicate, from where will you start again?
Try for this example
abcdeaifjlbmnodpq.
It will be still O(26*n) as at max, we would have to start from each letter
and go forward maximum 26times( if we reach 26 then we have i
Vaibhav
What do you thing the complexity of your algo is. And once you hit an
duplicate, from where will you start again?
On Fri, Jul 22, 2011 at 7:21 PM, wrote:
> String is "abcded"
> l =0, h = 0
> i = 1, l = 0, h = 1, max = 1, A[a]=1
> i = 2, l = 0, h = 2, max = 2, A[b] = 2
> i = 3, l = 0, h =
1 - 100 of 139 matches
Mail list logo