@atul: can u pls explain ur code...?
On 7/22/11, Puneet Gautam puneet.nsi...@gmail.com wrote:
@atul: thanks..!
On 7/22/11, atul purohit gonewiththe...@gmail.com wrote:
@puuneet
http://en.wikipedia.org/wiki/Sorting_algorithm#Stability
On Fri, Jul 22, 2011 at 10:57 AM, Puneet Gautam
Hi
Given an array of size N that contain some elements, Write a program for
finding all possible subset of size R .
n
i.e. P
r
Array :[1,2,3,4]
n=4,r=3;
Output should be:
{1,2,3},(1,2,4).{2,3,4},{...} possible 24 sets.
Thanks
--
You
@atul: can you please elaborate the algorithm you are using.
--
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/-/mLtfUz77JMIJ.
To post to this group, send email
@Abhi
See every character in the string is read exactly once and hashed. So
the complexity is O(n) only.
Mistake you're doing is adding n/2 n times, but if you see in your
example you have to add it twice only.
--
AP
--
You received this message because you are subscribed to the Google Groups
@atul: can u pls tell me how did u go about solving this in ur mind..?
On 7/22/11, Abhi abhi123khat...@gmail.com wrote:
@atul: can you please elaborate the algorithm you are using.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view
@umesh: can R take any value from 1 to 3..?
On 7/22/11, UMESH KUMAR kumar.umesh...@gmail.com wrote:
Hi
Given an array of size N that contain some elements, Write a program for
finding all possible subset of size R .
n
i.e. P
r
Array :[1,2,3,4]
n=4,r=3;
Heya,
Someone please explain dinesh's approach with an example.
I am not able to get the answer. Doing some mistake.
--
AP
--
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
@atul
Your algo is not stable
http://www.ideone.com/DrV5J
BTW what are u trying to do
instead of posting a code please prefer posting a simple algorithm in text
coding part is very easy once the correct algorithm is found
On Fri, Jul 22, 2011 at 11:43 AM, Puneet Gautam
No, every character won't be read exactly once.
--
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/-/lU8COVBGWSwJ.
To post to this group, send email to
yes R is actually size of subset that is always less than or equal to Size
of the Array
i.e r=n
On Thu, Jul 21, 2011 at 11:16 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:
@umesh: can R take any value from 1 to 3..?
On 7/22/11, UMESH KUMAR kumar.umesh...@gmail.com wrote:
Hi
Given an
The approach by atul is maintaining partitions of array such that element
left to it are even and right odd.Its an implementation of quick sort as
discussed earlier.Its o(n) no doubt but its not stable.
On Fri, Jul 22, 2011 at 11:51 AM, sunny agrawal sunny816.i...@gmail.comwrote:
@atul
Your
right..
To do it in O(n) we will need O(n) extra space.
and without extra space we can use a divide and conquer approach with O(lgn)
stack space
On Fri, Jul 22, 2011 at 12:04 PM, saurabh singh saurab...@gmail.com wrote:
The approach by atul is maintaining partitions of array such that element
Anybody try for maintain the stable of elements in O(n) as like
Input is :{1,2,3,4,5,6,7}
then Output should be
(2,4,6,1,3,5,7)
not..
{2,4,6,1,5,3,7} base on above discussion ..
--
You received this message because you are subscribed to the Google Groups
Algorithm
N people are standing in a circle ,they start shooting the person standing
*next to their neighbour.*If they start firing in this way , determine who
will be alive after this sequence??
Just for confirming, if only 2 person are left, then out of guilt of killing
other's does the person who has
@sunny: how do u do it by Divide n conquer ...can u provide the algo...?
On 7/22/11, UMESH KUMAR kumar.umesh...@gmail.com wrote:
Anybody try for maintain the stable of elements in O(n) as like
Input is :{1,2,3,4,5,6,7}
then Output should be
(2,4,6,1,3,5,7)
not..
Oh yes you're right. Understood the algo incorrectly.
--
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
check this out: Considering all 4 bytes of int with no left or right shifts..!!
;)
main()
{ unsigned int i,j,k,no=1;
j=4;
for(k=0;k32;k++)
no*=2;
no=no-j;
cout\n The reverse isno;
getch();
return 0;
}
On 7/22/11, nicks
Divide and Conquer Algorithm : Just like merge Sort of Quick sort...we
just need to modify the merge step of merge sort or Partition step of Quick
sort
lets call our this method Arrange();
//just as merge step takes two sorted arrays and make one completely sorted
one
it takes 2 arrays which
yes, occording to conditions he has to :)
On Fri, Jul 22, 2011 at 12:24 PM, Pankaj jatka.oppimi...@gmail.com wrote:
N people are standing in a circle ,they start shooting the person
standing *next to their neighbour.*If they start firing in this way ,
determine who will be alive after this
For people who like the generic way,its merge sort only difference is where
comp(a,b) returns true when a%2=1a%2=0.
Rest its same.
On Fri, Jul 22, 2011 at 1:12 PM, sunny agrawal sunny816.i...@gmail.comwrote:
Divide and Conquer Algorithm : Just like merge Sort of Quick sort...we
just need
Yes, the solution with Circular linked list works fine but it certainly
involves great space considerations. I guess solving Josephus problem using
dynamic programming more apt. It's O(n) as well.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
@khattri and khurana:
traverse the string once.
suppose the string is abcdeabcdeabcde
take a hashtable (initially set the items to -1) .now hash as per
khurana's idea till no duplicate occurs.Instead of marking 1. mark the
array index in the hashtable.
so in the hash table, we have
a=0 b=1 c=2 d=3
sorry guys.. dont check the above siolution.. its wrong...!!!
misread it..
On 7/22/11, Puneet Gautam puneet.nsi...@gmail.com wrote:
check this out: Considering all 4 bytes of int with no left or right
shifts..!!
;)
main()
{ unsigned int i,j,k,no=1;
j=4;
for(k=0;k32;k++)
@sunny: got dat...
On 7/22/11, saurabh singh saurab...@gmail.com wrote:
So many why's..:)
I was just trying to explain the queries about the divide and conquer asked
above.+1 to u sunny.
On Fri, Jul 22, 2011 at 1:26 PM, sunny agrawal
sunny816.i...@gmail.comwrote:
Yes thats true,
but
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 puneet.nsi...@gmail.comwrote:
sorry guys.. dont check the above siolution.. its wrong...!!!
misread it..
On 7/22/11, Puneet Gautam puneet.nsi...@gmail.com wrote:
check this out:
My algo for this prob:
Maintain an array A for characters from a-z which stores the index of
character encountered in the string. (initially all = -1)
iterate over all the characters in the string maintaining low and high
variables (initially both = 0) and max (initially = 0, stores length
of
@rawat: your algo doesn't compute the length of the largest unique
sub-string as far as I can infer or it needs further steps to be done.
Abhishek Khattri
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the
@svm11: Take the case with original string abcded output should be 5 but
your algo will give the answer as 0.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Q)complexity to find subwords in a given word?
ex: abcde
ans: a b c d e
ab bc cd de
abc bcd cde
abcd bcde
abcde
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
n+(n-1) +(n-2)++1 = O(n^2)
On Fri, Jul 22, 2011 at 3:16 PM, DeeJJ..! suryaprakash...@gmail.com wrote:
Q)complexity to find subwords in a given word?
ex: abcde
ans: a b c d e
ab bc cd de
abc bcd cde
abcd bcde
abcde
--
You received this message because
@sunny...yaa..but can u just describe the algorithm..:)
On Jul 22, 2:51 am, sunny agrawal sunny816.i...@gmail.com wrote:
n+(n-1) +(n-2)++1 = O(n^2)
On Fri, Jul 22, 2011 at 3:16 PM, DeeJJ..! suryaprakash...@gmail.com wrote:
Q)complexity to find subwords in a given word?
ex: abcde
what algorithm, print it subsequently
is there any ?
On Fri, Jul 22, 2011 at 3:24 PM, DeeJJ..! suryaprakash...@gmail.com wrote:
@sunny...yaa..but can u just describe the algorithm..:)
On Jul 22, 2:51 am, sunny agrawal sunny816.i...@gmail.com wrote:
n+(n-1) +(n-2)++1 = O(n^2)
#includestdio.h
int main()
{
int i=1;
printf(%d%d%d%d,++i,++i,++i,i++);
return 0;
}
Explain how it will be evaluated ?? and the 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
Values will be Pushed to the Stack from left to right and Evaluated to be
finally printed from the Stack.
On Fri, Jul 22, 2011 at 4:01 PM, rShetty rajeevr...@gmail.com wrote:
#includestdio.h
int main()
{
int i=1;
printf(%d%d%d%d,++i,++i,++i,i++);
return 0;
}
Explain how it will
Some more explanation taking an example will be helpful
take the example in the program.
Thanks
On Fri, Jul 22, 2011 at 4:03 PM, Prem Krishna Chettri hprem...@gmail.comwrote:
Values will be Pushed to the Stack from left to right and Evaluated to be
finally printed from the Stack.
On Fri,
@nicks- Dev-cpp supports gcc compilers only. Just saying
--
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/-/tpDu2bt_tG8J.
To post to this group, send email to
@T3rminal- Agreed. Thus the expressions like : a[i] = i++; , i=i++ - --i;
are irrelevant
--
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/-/-lYHVFcDjXYJ.
To
Please check this : http://www.techinterview.org/post/526313890/bad-king
On Tue, Jul 19, 2011 at 8:43 PM, sagar pareek sagarpar...@gmail.com wrote:
hey guys pls tell any other better solution ...
On Tue, Jul 19, 2011 at 6:41 PM, sagar pareek sagarpar...@gmail.comwrote:
Question :-
Once
initial call
subset(a,n,r,0,0);
printf(%d,count);//to know the value of nPr (no of subsets)
*
void subset(int a[],int n,int r,int j,int ind)
{
int i;
if(ind==r)
{
printf({);
for(i=0;iind;i++)
printf(%d ,a[i]);
printf(}\n);
count++;
}
here's O(1)
x = n-pow(2,floor(log2(n)));
pos = x*k+1;
surender
On Fri, Jul 22, 2011 at 1:19 PM, Interstellar Overdrive
abhi123khat...@gmail.com wrote:
Yes, the solution with Circular linked list works fine but it certainly
involves great space considerations. I guess solving Josephus problem
small change here
x = n-pow(2,floor(log(n)));
pos = (x*k)%n+1;
surender
On Fri, Jul 22, 2011 at 4:54 PM, surender sanke surend...@gmail.com wrote:
here's O(1)
x = n-pow(2,floor(log2(n)));
pos = x*k+1;
surender
On Fri, Jul 22, 2011 at 1:19 PM, Interstellar Overdrive
Output:
5,4,3,1
*Explanation:*
Since the brackets acts as right precedence, the execution of the statement
is from right to left. The comma separates the individual.
For i++, it prints the current 'i' value and increments it by 1.
For ++i, it increments the value by 1 and prints the updated
explanation for dinesh's algo.
let the sting is:arr[]=my name is kamakshi
first reverse the whole string by swapping characters from beginning and end
strlen(arr)=19;
now process till 19/2=9
swap(arr[0].arr[strlen-1])
now swap (arr[1],arr[strlen-2]);
this way u will reverse the string in place.
sorry, for the previous post,
consider this...
iterate the string using variable i
'low' is another variable that stores the index of previous occurrence
of the character+1
initially, i=0 , low=0
max=i-low
abcdedepoiuytu
hashtable :
a= -1 , b= -1, . . . z = -1
a=0
b=1
c=2
d=3
e=4
now, d comes
undefined behaviour.
since value of i is changing more than once between two sequence points..
On Fri, Jul 22, 2011 at 5:42 PM, suresh srinivasan suree...@gmail.comwrote:
Output:
5,4,3,1
*Explanation:*
Since the brackets acts as right precedence, the execution of the statement
is from
associativity rule is compiler dependent ...thats why undefined...
On Fri, Jul 22, 2011 at 5:46 PM, Kamakshii Aggarwal
kamakshi...@gmail.com wrote:
undefined behaviour.
since value of i is changing more than once between two sequence points..
On Fri, Jul 22, 2011 at 5:42 PM, suresh srinivasan
There is NO universal way of doing this; every compiler does it differently,
in its own ways.
The problem here is that the above code changes the value of variable `i'
many times between two sequence points. So you cant be sure as to what value
`i' holds at what time!!!
For more insight and a
@Sunny: Excellent explanation ( solution) !!
--
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
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 = 3, max = 3, A[c] = 3
i = 4, l = 0, h = 4, max = 4, A[d] = 4
i = 5, l = 0, h = 5, max = 5, A[e] = 5
i = 6, 'd' is encountered again, update l = A[d] = 4, new A[d] = 5, h = 6,
@surender: I assume you want to give general solution to Josephus problem in
which we shoot every kth person...In that case formula for pos must be:
pos = ( x*k )%n + (k-1)
In current context, k=2...thus the formula which you gave also holds
true..but not when k != 2
--
You received this
Its not the associativity which is undefined (Associativity has been defined
*clearly* by the C Standards for each and every operator). Its the order of
evaluation between 2 sequence
pointhttp://en.wikipedia.org/wiki/Sequence_points
which is undefined and hence compiler-dependent.
On gcc version
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, vaibhavmitta...@gmail.com 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
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
@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 kp101...@gmail.com wrote:
@surender: I assume you want to give general solution to Josephus problem
in which we
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
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
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
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
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 anuragmsi...@gmail.comwrote:
Worst case 99 get released.
Is that correct..?
--
You received this
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 jatka.oppimi...@gmail.com wrote:
abcdeaifjlbmnodpq
For this once you
*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
josehus problem???
On Fri, Jul 22, 2011 at 7:57 PM, Pankaj jatka.oppimi...@gmail.com 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
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 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
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 chetankapoor...@gmail.comwrote:
josehus problem???
On Fri, Jul 22, 2011 at 7:57 PM, Pankaj jatka.oppimi...@gmail.com wrote:
Skipp Riddle,
Yes.
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:20
https://ideone.com/kzo2L
Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj jatka.oppimi...@gmail.com 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,
https://ideone.com/kzo2L
Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj jatka.oppimi...@gmail.com 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,
https://ideone.com/kzo2L
Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj jatka.oppimi...@gmail.com 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,
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 abeygau...@gmail.com
@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
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 jatka.oppimi...@gmail.com wrote:
Vaibhav, Ok write your code and paste on
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 sivavikne...@gmail.comwrote:
@ankur.. as u said i m posting today :) :)
10
post the 10 questions plz
On Fri, Jul 22, 2011 at 8:29 PM, shady sinv...@gmail.com 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
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 Institute Of
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
gr8 shubham
On Fri, Jul 22, 2011 at 1:42 PM, Shubham Maheshwari
shubham@gmail.comwrote:
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 puneet.nsi...@gmail.comwrote:
sorry guys.. dont check the above siolution.. its
Thanx for pointitn out the case :) Hope dis wil wrk.
https://ideone.com/0LNkW
On , Pankaj jatka.oppimi...@gmail.com wrote:
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwzzyyzzabc
output:
Length of largest unique substring : 51
Sorry it gt posted thrice.
On Jul 22, 7:50 pm,
thanks
its almost same :)
i was hoping for a diff answer (if exists)
On Fri, Jul 22, 2011 at 4:25 PM, Rajeev Kumar rajeevprasa...@gmail.comwrote:
Please check this : http://www.techinterview.org/post/526313890/bad-king
On Tue, Jul 19, 2011 at 8:43 PM, sagar pareek sagarpar...@gmail.comwrote:
@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.
thnx ...
:D
On Fri, Jul 22, 2011 at 9:19 PM, sagar pareek sagarpar...@gmail.com wrote:
gr8 shubham
On Fri, Jul 22, 2011 at 1:42 PM, Shubham Maheshwari shubham@gmail.com
wrote:
x = 0;
while( n ){
x = 1;
x = x | ( n 1);
n = 1;
}
return x;
On Fri, Jul 22, 2011 at 1:31 PM,
could some1 plz post the xplainations ...
On Fri, Jul 22, 2011 at 8:04 PM, Pankaj jatka.oppimi...@gmail.com 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
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
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
how are you gonna do it if the originl strng contains repeated letters ...
On Fri, Jul 22, 2011 at 3:33 PM, shady sinv...@gmail.com wrote:
what algorithm, print it subsequently
is there any ?
On Fri, Jul 22, 2011 at 3:24 PM, DeeJJ..! suryaprakash...@gmail.comwrote:
@sunny...yaa..but
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
#includestdio.h
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))
what kind of joke is this ?
On Fri, Jul 22, 2011 at 11:02 PM, geek forgeek geekhori...@gmail.comwrote:
#includestdio.h
main()
{
FILE *fp;
char a;
fp=fopen(old.out,w);
if(fp==0)
printf(File opening error);
else
{
@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 sinv...@gmail.com wrote:
what kind of joke is this ?
On Fri, Jul 22, 2011 at 11:02 PM, geek forgeek geekhori...@gmail.comwrote:
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 @
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 geekhori...@gmail.comwrote:
@shady this is nt a joke..
sorry if i am asking too stupid question
i m getting
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 sinv...@gmail.com wrote:
well you didn't mention the question, directly posted the
@shady. so in this case we shud use a!=-1 as the condition??
On Fri, Jul 22, 2011 at 11:37 PM, shady sinv...@gmail.com 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
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 aditi.garg.6...@gmail.comwrote:
@shady. so in this case we shud use a!=-1 as the condition??
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
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 lks.ru...@gmail.com wrote:
No, actually , a is defined as char ... and comparing char with EOF ,,
makes it go in infinte loop...as it never returns
@script kiddle
y u r rght ...i can smell too.. :P
On Fri, Jul 22, 2011 at 11:52 PM, varun pahwa varunpahwa2...@gmail.comwrote:
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
@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
@shady and @varun ...
i hav got it
thanx both of u :)
On Fri, Jul 22, 2011 at 11:31 AM, shady sinv...@gmail.com 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
+1 to t3rminal
On Jun 12, 11:38 pm, T3rminal piyush@gmail.com 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
#includestdio.h
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\n,x);
1 - 100 of 148 matches
Mail list logo