output -text1text2
text2
explaination-system call fork creates a child process copying the whole
code of parent but the execution of child process will start after the line
where fork is called.thus the two process parent and child will print text2
twice
--
You received this message
output - text1text2
--
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
I guess this approach will work..
--
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/-/zeydVF1OqioJ.
To post to this group, send email to
Yeah...anyone plz tell good book for OS concepts
--
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/-/aVShOmMEE_cJ.
To post to this group, send email to
http://www.learncpp.com/cpp-tutorial/912-shallow-vs-deep-copying
Go through this link..
--
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/-/NIWaOsWRCT0J.
To
int main()
{
int a[]={4,3,5,2,6}; // 1 4 12 60 120
const int n=5;
int temp=1,i;
int b[5]={0};
for(i=0;in;i++)
{
b[i]=temp;
temp*=a[i];
}
temp=1;
for(i=n-1;i=0;i--)
{
b[i]*=temp;
temp*=a[i];
void main()
{
void *ptr;
char *a='A';
char *b=TAN;
int i=50;
ptr=a;
ptr=(*char)malloc(sizeof(a));
printf(%c,*ptr);
ptr=i;
ptr=(*int)malloc(sizeof(i));
printf(%d,++(*ptr));
ptr=b;
ptr=(*char)malloc(sizeof(b));
printf(%c,++(*ptr));
}
Ans: A51AN
Please explain the output..
Doesnt this line
void main()
{
void *ptr;
char *a='A';
char *b=TAN;
int i=50;
ptr=a;
ptr=(*char)malloc(sizeof(a));
printf(%c,*ptr);
ptr=i;
ptr=(*int)malloc(sizeof(i));
printf(%d,++(*ptr));
ptr=b;
ptr=(*char)malloc(sizeof(b));
printf(%c,++(*ptr));
}
ptr=(*char)malloc(sizeof(a));
Ans: A51AN
Please explain the
On Friday, 16 September 2011 13:25:38 UTC+5:30, Anup wrote:
#includestdio.h
int main()
{
int a[5]={1,2,3,4,5};
int *ptr=(a + 1);
int *ptr=(int *)(a + 1);
printf(%d %d\n,*(a+1),*(ptr-1));
return 0;
}
Find the output!
Now it will print 2 5
--
You received this message
yes..please anyone post questions asked in thoughtworks interview
--
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/-/Rpd5yw77HbMJ.
To post to this group, send
This is the fastest way I can think of to do this, and it is linear to the
number of intervals there are.
Let L be your original list of numbers and A be a hash of empty arrays where
initially A[0] = [0]
sum = 0
for i in 0..n
if L[i] == 0:
sum--
A[sum].push(i)
elif L[i] == 1:
Yaarr do u have pdf file of this book??
--
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/-/J3_X1gBC3-sJ.
To post to this group, send email to
If u have pdf file of this book please attach it :)
--
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/-/UAtjWdjmTIEJ.
To post to this group, send email to
i==n
j==i*i= n*n
k==j=i*i=n*n so total i*j*k=n^5
--
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/-/jv1X4YzDp_sJ.
To post to this group, send email to
Yeah..agree with this... Just find minimum no and increment that..! Any
counter-example??
On Saturday, 10 September 2011 01:19:41 UTC+5:30, hashd wrote:
For question 2 I guess finding the minimum element's index should suffice
(considering all elements are positive integer). No need to even
for RT angled triangle , 0 cudnt be the answer , for obvious reason..
however it'll very small and close to zero...
and for any two points on the circumference , there will be a point by which
u can make rt angle triangle..
On Saturday, 10 September 2011 18:19:25 UTC+5:30, Neha Singh wrote:
let say there are n points on the circumference,
then for rt angle triangle ,
answer would be nC2..select any two points , u'll always get a point which
will make rt angle triangle.. but again we can not define no of points on
circle..so :|
On Saturday, 10 September 2011 14:47:53 UTC+5:30,
But probability ZERO means , impossible scenario , while this is possible so
better say very less, near to zero..not zero exactly :P
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Guys please suggest me any good book for object oriented programming..which
have lots of example of good design pattern.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
make a max heap of size K , and keep inserting all the elements in it.. and
at last the root will be the k-th largest element ! O(nlogk)
On Thursday, 8 September 2011 22:32:52 UTC+5:30, Sandeep Chugh wrote:
wat abt creating a max heap? and then deleting root element k-1 times..
after then
Please reply with your alog...!
--
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/-/OGVCUV_hutUJ.
To post to this group, send email to
This can be solve by considering following case:
i) If all the letters in the word are distinct : Just concatenate, reverse
of the string(excluding last letter) to the original word..e.g. ZXKH==ZXKH
KXZ
ii)If two letters are same in the word : First ignore all the letters
between those same
It is problem of loss of data..as pow(x,y) returns double value and adding
it to int truncate some data... if u write this
sum+=(float)pow(r,3); it'll work fine!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the
Yaar second question thoda elaborate kar.. didn't get it !
--
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/-/3ClTQN8-GBEJ.
To post to this group, send email to
Sort the array and use dynamic programming.. it will take at most n^2
complexity.!
BY dynamic programming , i mean make a 3D type array.. which will give all
the combination which sums to all the nos.. try it!
--
You received this message because you are subscribed to the Google Groups
Can anyone please post the pattern and questions asked by winshuttle ,
as it is coming to my college tomorrow..??
--
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
lol.. Tu bhi yahin pe?
yaar samsung me intern he mili hai.. final offer nahi :| and btw
winshuttle us se achhi hai shayad!
On Aug 27, 4:08 pm, SANDEEP CHUGH sandeep.aa...@gmail.com wrote:
@birju : Samsung nhi leni kya??
On Sat, Aug 27, 2011 at 12:45 PM, Brijesh brijeshupadhyay
How to add two nos without using any operator...?
--
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/-/MpNKzlE3UuwJ.
To post to this group, send email to
has anyone given MMT written test.?? please reply , what is the
pattern of the paper?
--
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
But it is not circular doubly linked list.,..so u could not traverse in
backward dirction from HEAD node..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
At the node from where the loop just started.. anyway we could not use that
logic , coz it isnt circular linked list!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Make an array of size n, and fill it with index of last 1 of corresponding
row in the matrix.. as if row 0 has 1101100 , than arr[0]=4 .
so we end up with an array containing last position of 1 in the respective
row..
lets arr[4] is like 3,2,2,1... we have to make it 1,2,2,3.. so now apply
IT is the question..
You are given an N x N matrix with 0 and 1 values. You can swap any two
adjacent rows of the matrix.
Your goal is to have all the 1 values in the matrix below or on the main
diagonal. That is, for each X where 1 ≤ X ≤ N, there must be no 1 values in
row X
that are to
Actually it was one of the assignments given to me in lab.. here is the code
#include iostream.h
#include conio.h
using namespace std;
int a[20][20][20]; // Global declration to make every cell's default value
to zero
// 3D matrix to implement the algorithm
void combinations(int number) //
Algorithm to find the two numbers whose difference is minimum among the set
of numbers. For example the sequence is 5, 13, 7, 0, 10, 20, 1, 15, 4, 19
The algorithm should return min diff = 20-19 = 1. Constraint - Time
Complexity O(N)
--
You received this message because you are subscribed to
int main ()
{
printf(%d,1+2+5);
getch();
return 0;
}
what should it return and how..??
--
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/-/2H3Gg6hLEQ0J.
I think i got it... STRING always return address of S , which then get
summed with 1 and 2.
--
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/-/kFrZUxzFTxsJ.
Dynamic programming would surely help but i dont know the algo :| :P
--
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/-/MD3432cto60J.
To post to this group,
It could have a maximum of 81 leaves with the same '40' no of internal
nodes so for any value between 28 to 81, it would have only 40 internal
nodes
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
thank u , i couldnot have answered this :P
--
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/-/Gppo1P-Gr9oJ.
To post to this group, send email to
Yeah...please share questions..it will be of a lot help!
--
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/-/cs4XYfgJrooJ.
To post to this group, send email to
100 men women dance with each other. What is the Probability that a
man cannot dance with more than two women?
--
Regards,
Brijesh Upadhyay
CSE
Thapar University
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
No thers is not.. someone has asked me this., dont know anything else about
the question :|
--
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/-/mqMvDgb6TqUJ.
simple algo.. :
let we have to find leftmost right cousin of x!
try to get an ancestor of the node x such that x lies in left subtree of
that ancestor , and count no of levels , say L, u moved to get that
ancestor..now start from that ancestor to get left most node , by going down
L
simple algo.. :
let we have to find leftmost right cousin of x!
try to get an ancestor of the node x such that x lies in left subtree of
that ancestor , and count no of levels , say L, u moved to get that
ancestor..now start from that ancestor to get left most node IN THE RIGHT
SUBTREE , by
10
4 5
2 7 6 11
1 39 8 12 13 14 15
let u have to fine leftmost right cousin of 8 . , move up , u get 10 as the
ancestor , such that its left subtree contains 8 , unlike 7 ,4 (whose right
I dont think 27 is the right answer,... it should be log 28 /log 3... i mean
log 28 base 3 shuold be the no. of internal nodes ! and for any no of
leaves , 2781, the answer would be same...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
80??? how can 80 internal nodes just produce only maximum of 81 leaves and
that too in 3ary tree
the answer is 1+3+9+27 = 40 internal nodes... think like this
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on
1 produces 3 nodes , which then 9 nodes,-- 27 nodes , and thses 27
nodes finally produces =81 leaves so sum of 27+9+3+1= 40 is the right
answer... i guess
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web
General approach would be , get the no of levels first by log 28 /log 3 , =
4(use ceiling)...and now 3^0+3^1+3^2+3^3 = 40 will be no of internal nodes..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
int main()
{
int a[3][4]={1,2,3,4,5,6,7,8,9,10,11,12};
printf(%u %u %u,a, a+1,a+1);
getch();
}
how a+1 is valid..?? please explain
--
Regards,
Brijesh Upadhyay
CSE , final year.
Thapar University
--
You received this message because you are subscribed to the Google Groups
Thank you , every 1 . got it...
--
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/-/3cPVG1k4kJ4J.
To post to this group, send email to
Yeah.. 3rd answer is 1:1 , for reference
http://discuss.fogcreek.com/techInterview/default.asp?cmd=showixPost=150
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
#includeiostream.h
#includeconio.h
int main()
{
int a[2]={1,2};
coutsizeof(a) sizeof(a)endl;
couta aendl;
couta+1 a+1endl;
getch();
}
It gives size of 'a' as 8 and 'a' as 4...which i hadnt expected.. and then
a+1 is increasing just 4 while a+1 is increasing 8 in
Yeah..right..! u have to select continuous 10 petrol pumps , so just
traverse through every set of 10 pumps with complexity of o(n). e.g. (1,10)
(2,11) (3,12)(91 ,100)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
Could u please explain how shell sort... why not quick sort??
On Aug 7, 10:42 pm, sourabh jakhar sourabhjak...@gmail.com wrote:
shell sort is the correct answer
On Sun, Aug 7, 2011 at 11:09 PM, ankit sambyal ankitsamb...@gmail.comwrote:
bubble sort
--
You received this message because
How?? could u please explain..? why not quick sort?
On Aug 7, 10:27 pm, rajeev bharshetty rajeevr...@gmail.com wrote:
b:Shell sort
On Sun, Aug 7, 2011 at 10:56 PM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:
1.what is the best sorting method for almost sorted array?
I think 17/80 is right answer.. otherwise no use of mentioning *first five
times* specifically in the question. ! though m not sure
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
main()
{
int i,j;
i=10;
j=sizeof(++i);
printf(%d,i);
}
please give the output with explanation!
--
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,
Please give the output and explain..
main()
{
int i=7;
printf(%d\n,i++*i++);
printf(%d\n,i++*++i);
printf(%d\n,++i*i++);
printf(%d\n,++i*++i);
}
What is the order of execution!?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
We can do it by just having an extra pointer variable which will store
either rightmost 2's *next node* or left most 2's *previous node*(as
it is doubly linked list)..now start traversing through rear end , if
u get 1 , send it to front..if u get 3 send it to rear , and if u get
2 the insert it
@ankur I didnt get this... could u or anyone please elaborate!
On Jul 30, 12:43 am, Ankur Khurana ankur.kkhur...@gmail.com wrote:
when you use itoa , what you get is a string. get the sum of all the digits
, using c-'0' and then use repeated subtraction . . .
On Sat, Jul 30, 2011 at 1:01 AM,
62 matches
Mail list logo