Re: [algogeeks] Amazon - Coding Round-2 Qn

2011-08-30 Thread Dipankar Patro
BST in a Binary tree is a repeated question. Two things you have to find: - Check from every node to down whether the subtree is binary or not. - Once done check the no. of nodes in the subtree. - Finally keep track of the max you have got so far. On Wed, Aug 31, 2011 at 7:04 AM, Reynald

Re: [algogeeks] Re: prog

2011-08-27 Thread Dipankar Patro
DBMS is Data-Base Management System. It is the concept of managing data so that retrieval, modification, etc operations can be carried out efficiently. It has different models for implementation. RDMS (Relational DBMS) is a model of DBMS that uses tables to manage data. Other models also exist,

Re: [algogeeks] Re: microsoft

2011-08-27 Thread Dipankar Patro
Just go through Test Your C-Skills properly for first section: Here are some questions that I faced: Section 1 problems. Total time 30 minutes: 1. x = x^x; printf(%d, x); o/p? 2. some automation-graph question. I think it was based on Automata. Not sure though. 3. z = scanf(%d %d, x, y);

Re: [algogeeks] Re: Winshuttle Pattern and Question *Urgent*

2011-08-27 Thread Dipankar Patro
First round written - Two parts : 20 C-questions, + 5 Apti Time 25 minutes. C-questions - all copied from Test Your C-Skills. (literally). Just mug up all questions from Test Your C-Skills. Second coding round. Simple algo based, written (15 minutes) Interview rounds after that. On Sun, Aug

Re: [algogeeks] Re: C dot

2011-08-24 Thread Dipankar Patro
C-Dot procedure (For Computers): - First shortlist on the basis of cgpa/ %age for interviews. - Only one round of interview, based on your resume. Discussion of projects and questions related to mainly OS, Networking and Programming. There is nothing as selection of Toppers only. If you are good

Re: [algogeeks] Re: c question what is output?

2011-08-21 Thread Dipankar Patro
+1 to 16. whats the confusion here? On 21 August 2011 16:44, sagar pareek sagarpar...@gmail.com wrote: Arey yaar just see the my post... i explained it step by step :) On Sun, Aug 21, 2011 at 4:43 PM, Sanjay Rajpal srn...@gmail.com wrote: 16 8*(8-1*(8-1-1)) Sanju :) On Sun, Aug

Re: [algogeeks] query.. amazon question

2011-08-20 Thread Dipankar Patro
, that constraint is not specified.. thx, --Gopi On Sat, Aug 20, 2011 at 9:25 AM, Dipankar Patro dip10c...@gmail.comwrote: Fixed the problem. There was a problem with the first element positioning. Here is the final solution: http://ideone.com/XwymV ^^ Time complexity - O(2n) Space complexity O

Re: [algogeeks] C-Question

2011-08-20 Thread Dipankar Patro
float is 4 bytes. so a=3.75 will be stored in 4 bytes in memory. the moment you have a pointer referring to the same memory location but type cast to (char *), the pointer will refer to character i.e. 1 byte. ^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75 now finally the o/p

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Dipankar Patro
why traverse the whole tree? at each root keep the difference in a min_diff and min_ele. if the entered value is less root then move to left or right. repeat above two until whole tree is checked or min_diff becomes 0. pseudo code: min_diff = INF; // global variables min_ele = 0;

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Dipankar Patro
traversal of the tree.) On Sat, Aug 20, 2011 at 12:46 PM, Dipankar Patro dip10c...@gmail.comwrote: why traverse the whole tree? at each root keep the difference in a min_diff and min_ele. if the entered value is less root then move to left or right. repeat above two until whole tree

Re: [algogeeks] Syllogism

2011-08-20 Thread Dipankar Patro
yes, i think so On 20 August 2011 10:52, sukran dhawan sukrandha...@gmail.com wrote: yes On Sat, Aug 20, 2011 at 10:26 AM, geek_one abhishekgupta.it...@gmail.comwrote: Statement: Some girls are beautiful. Conclusion: Some girls are not beautiful. is the conclusion is true on the basis

Re: [algogeeks] important question on ADT

2011-08-19 Thread Dipankar Patro
(c) On 19 August 2011 23:18, sukran dhawan sukrandha...@gmail.com wrote: yes c is the answer.for ex for stack the valid operations are push,pop,isempty,peep On Fri, Aug 19, 2011 at 10:57 PM, ghsjgl k ghsk...@gmail.com wrote: An abstract data type is (a) same as abstract class (b) a

Re: [algogeeks] query.. amazon question

2011-08-19 Thread Dipankar Patro
http://ideone.com/ucO4d Total no. of elements should be even (I assume) and it is also failing for some test cases. Working on to zero down to the error in algo. On 20 August 2011 02:11, JAIDEV YADAV jaid...@gmail.com wrote: this was earlier in this group... Please see this paper:

Re: [algogeeks] query.. amazon question

2011-08-19 Thread Dipankar Patro
Fixed the problem. There was a problem with the first element positioning. Here is the final solution: http://ideone.com/XwymV ^^ Time complexity - O(2n) Space complexity O(1) :) On 20 August 2011 08:14, Dipankar Patro dip10c...@gmail.com wrote: http://ideone.com/ucO4d Total no. of elements

Re: [algogeeks] Re: Amazon Interview Q

2011-08-18 Thread Dipankar Patro
we can do that too. But if I return cur then I can myself print cur, cur-next, cur-next-prev. for verification. On 18 August 2011 11:56, Vijay Kansal vijaykans...@gmail.com wrote: We should return curr-next in the last statement of ur code On Aug 18, 7:08 am, Dipankar Patro dip10c

Re: [algogeeks] Re: Amazon question

2011-08-18 Thread Dipankar Patro
O(1) space means constant space. It doesn't mean you can't use extra space. Refer here: http://stackoverflow.com/questions/2219109/what-does-this-mean-on-steps-and-o1-space According to the question you can definitely use a Hash Table for keeping hit record, as it will be a constant space

Re: [algogeeks] Re: Answer this !!

2011-08-18 Thread Dipankar Patro
Overriding doesn't remove the function. It just changes the function definition. So 2 will be the answer. On 19 August 2011 00:33, siddharth srivastava akssps...@gmail.com wrote: On 19 August 2011 00:31, priya ramesh love.for.programm...@gmail.comwrote: it can remove methods defined in

Re: [algogeeks] Amazon Interview Q

2011-08-17 Thread Dipankar Patro
I have come up with this: - Use only one pointer, NODE *cur - initialize cur to headref - The main loop: while (cur) { if(cur-next-prev != cur) break; cur=cur-next; } return cur; ^^ I think the code is self explanatory. It just uses the fact that at loop, the prev of next to current

Re: [algogeeks] Amazon Interview Q

2011-08-17 Thread Dipankar Patro
A slight change in above code: make it while(cur cur-next) ^^ other wise the code will crash at last element in a prefect list, with no loop. On 18 August 2011 07:36, Dipankar Patro dip10c...@gmail.com wrote: I have come up with this: - Use only one pointer, NODE *cur - initialize cur

Re: [algogeeks] Counting

2011-08-17 Thread Dipankar Patro
How about using vertices and edges format in graphs? - Traverse through each vertex in vertices list, and add all the edges to the edge list if they are not already present in the edge list. - Keep a counter to detect addition of new edges. On 18 August 2011 01:31, Luciano Junior

Re: [algogeeks] Re: Output?? Why??

2011-08-17 Thread Dipankar Patro
Thats new.. Its not working in C++, where as in C it works like a charm. On 18 August 2011 08:57, vartika aggarwal vartika.aggarwa...@gmail.comwrote: @Aditi: That's because you haven't changed the language to 'C' (while working on ideone. It doesn't give an error in C) On Thu, Aug 18, 2011

Re: [algogeeks] Re: Output?? Why??

2011-08-17 Thread Dipankar Patro
, 2011 at 9:27 AM, Dipankar Patro dip10c...@gmail.comwrote: Thats new.. Its not working in C++, where as in C it works like a charm. On 18 August 2011 08:57, vartika aggarwal vartika.aggarwa...@gmail.com wrote: @Aditi: That's because you haven't changed the language to 'C' (while working

Re: [algogeeks] Prime numbers

2011-08-16 Thread Dipankar Patro
Sieve's is the fastest in generating prime numbers. +1 to Sandeep and Sanjay On 17 August 2011 08:21, Sanjay Rajpal sanjay.raj...@live.in wrote: Agree with Sandeep :) Try this link http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes. Hope it helps :) Sanjay Kumar B.Tech Final Year

Re: [algogeeks] reason

2011-08-15 Thread Dipankar Patro
I think while assignment the type conversion will take place. Whether you write it or not. check this out: http://ideone.com/y36vj ^^ Just giving off warnings, but it is working. On 15 August 2011 14:14, aditi garg aditi.garg.6...@gmail.com wrote: I think dis is bec int occupies 4 bytes while

Re: [algogeeks] mcq-os

2011-08-15 Thread Dipankar Patro
As stated by Rajeev, 2,3 are a part of process synch. So I also think all 3 On 15 August 2011 18:35, rajeev bharshetty rajeevr...@gmail.com wrote: All the above 1,2,3 Semaphores help to prevent race conditions in a program. They help in process synchronization by allowing multiple processes

Re: [algogeeks] Non recursive preorder and postorder

2011-08-15 Thread Dipankar Patro
Consult Tanenbaum buddy. It has provided a proper in-order traversal code. You will have to think a bit on that on your own too to get to post and pre order. Hint: - Check the sequence in which the elements are pushed and popped in stack. e.g. for pre order, print the node value as you reach any

Re: [algogeeks] Operators

2011-08-15 Thread Dipankar Patro
1 and 3, I guess. * used in multiplication (a*b) and also in pointers(*b). used in bitwise operations (ab)and also as address operator(b). Not sure about '#', haven't used much. On 15 August 2011 18:45, aditi garg aditi.garg.6...@gmail.com wrote: Pick the operators whose meaning is context

Re: [algogeeks] Algorithm

2011-08-15 Thread Dipankar Patro
For n/2 I came across a nice algo sometime back. here is how to do it (I am providing algo): int A[n], i, num, freq=0; set num = A[0] and freq= 1; // assume first number to be the n/2 times occurring element. from i=1 to n-1 { if (A[i] == num) freq++; else freq--; freq = (freq 0)?

Re: [algogeeks] program puzzle

2011-08-15 Thread Dipankar Patro
@ MeHdi : Please read the problem properly yaar. You are just reversing the string by characters, not by words. On 15 August 2011 20:34, MeHdi KaZemI mehdi.kaze...@gmail.com wrote: string str = i am a programmer for(int i = 0; i str.size()/2; i ++) swap(str[i], str[str.size()-i-1]);

Re: [algogeeks] string confusion

2011-08-14 Thread Dipankar Patro
@ Gaurav: in ASCII code : '\0' is actually 0, if you are confused with '0' and 0, first one the character and later one is Remember that '0' is not 0 in ASCII, rather value of '0' is 48. So they can be used in place of each other. [ Just expanding what Sagar is trying to say] On 14 August 2011

Re: [algogeeks] de shaw

2011-08-14 Thread Dipankar Patro
came across this on other forum.. http://forums.sureshkumar.net/de-shaw-placement-papers/17885-deshaw-technical-questions.html On 13 August 2011 23:32, sukran dhawan sukrandha...@gmail.com wrote: MVIT ? On Sat, Aug 13, 2011 at 9:02 PM, Dipankar Patro dip10c...@gmail.comwrote: Which college

Re: [algogeeks] array question

2011-08-14 Thread Dipankar Patro
how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady

Re: [algogeeks] array question

2011-08-14 Thread Dipankar Patro
@ Sagar: What if extra space in not allowed? I think then we have to use the binary search method... On 14 August 2011 18:50, sagar pareek sagarpar...@gmail.com wrote: Hashing O(n+m) On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro dip10c...@gmail.comwrote: how about binary search of each

Re: [algogeeks] Re: TRee question...

2011-08-14 Thread Dipankar Patro
/ \ 13 successor of 3 shall be 4 not 2.. On Fri, Aug 12, 2011 at 4:48 PM, ashmantak ashman...@gmail.com wrote: @Dipankar Patro - The figure u have made isn't a BST.Read the problem. His soln. is correct. -- You received this message because you are subscribed

Re: [algogeeks] Re: fork() question

2011-08-14 Thread Dipankar Patro
search in group archive, this question has been discussed very deeply On 14 August 2011 23:14, sivaviknesh s sivavikne...@gmail.com wrote: http://faq.programmerworld.net/networking/unix-interview-questions-answers.html refer 16 th ques in this site .. they ve told 2^n times..so only i asked

Re: [algogeeks] Re: array question

2011-08-14 Thread Dipankar Patro
)). Then the common element can be found in O(m + n) by a simple search that starts at i = j = 0 and increments the index of the lesser of a[i] and b[j]. Overall complexity is O(max(m log m, n log n)). Dave On Aug 14, 8:24 am, Dipankar Patro dip10c...@gmail.com wrote: @ Sagar: What if extra space

Re: [algogeeks]

2011-08-14 Thread Dipankar Patro
@ ghsjgl: At each step(m), the no. ways is equal to the sum of ways till m-1 and ways till m-2. Look at it as you have reached at m either by taking one step from m-1 or two steps from m-2. I hope that answers your query. On 14 August 2011 22:26, ghsjgl k ghsk...@gmail.com wrote: fibonacci

Re: [algogeeks] Re: an array question

2011-08-14 Thread Dipankar Patro
Ankur, I agree with your algo. - radix sort from least significant to most significant. - a slight modification can be done on the appending 0 part. when you find the a digit is absent from the number, you leave the number. e.g 95, 87, 9, 45, 38 one's place, sort: (descending) 9, 38, 87, 95, 45

Re: [algogeeks] Re: Storing of data in memory (endianness)

2011-08-14 Thread Dipankar Patro
wrote: @Dipankar: You are correct. The answer, like the answer to so many questions, is It depends. Dave On Aug 14, 1:11 pm, Dipankar Patro dip10c...@gmail.com wrote: Hi all, I have come across quite a few questions like What is the way in which int m = 2 will be stored in memory? 2

Re: [algogeeks] Re: an array question

2011-08-14 Thread Dipankar Patro
@ Kunal: oh. zero is making some nice test cases. I will have to reconsider the solution that I provided. On 15 August 2011 01:53, Yasir yasir@gmail.com wrote: Not Sure! Me too looking for a solution.. :D So far, Kunal's approach (Convert each string to length max_size where you append

Re: [algogeeks] Todays PEP question

2011-08-14 Thread Dipankar Patro
3. On 15 August 2011 01:07, rajeev bharshetty rajeevr...@gmail.com wrote: 3 is the answer . do being exit controlled loop , x is incremented to 2 and then checked for condition which happens to be false here (22) So t is incremented only 3 times. On Mon, Aug 15, 2011 at 12:44 AM, aditi

Re: [algogeeks] Value of base pointer VS Address of base pointer

2011-08-13 Thread Dipankar Patro
[Quote] arr has the address to the base of an array of three int's. arr is the address of the first element of that same array. [/Quote] ^^ Found on web. check the difference by printing arr+1 and arr+1. The former will skip one element, but later will skip the whole array. On 12 August 2011

Re: [algogeeks] n*n array

2011-08-13 Thread Dipankar Patro
I think they both refer to the same in case of 2-D array. helical can be seen as a movement in 3-D where it is spiral in two dimensions and linear in one left out dimension. On 13 August 2011 18:54, Kamakshii Aggarwal kamakshi...@gmail.com wrote: is printing a n*n array,spirally is same as

Re: [algogeeks] what is mean by %2.3d in scanf

2011-08-13 Thread Dipankar Patro
Nice one Gaurav Menghani On 13 August 2011 18:39, shady sinv...@gmail.com wrote: wonderful :) On Sat, Aug 13, 2011 at 6:30 PM, Rahul raikra...@gmail.com wrote: lol++ Rahul On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: lol On Sat, Aug 13, 2011 at

Re: [algogeeks] TRee question...

2011-08-12 Thread Dipankar Patro
What Deoki answered in valid for non-leaf node. Consider this tree: 3 / \ 4 5 / \ 6 7 According to Deoki's answer, 7's in-order successor is 4, which not correct. the answer should be 3. Here is the proper method (for leaf node only), Following Deoki's answer for non-leaf: - keep

Re: [algogeeks] cisco

2011-08-12 Thread Dipankar Patro
I think CISCO sacked the employees in 'Flip' Deptt. (as it appears on Web). Flip was something out of networking domain, and it failed. So CISCO is now refocusing on their networking infrastructure and networking products that it is famous for. Lets hope hiring will continue the same as last

Re: [algogeeks] Re: microsoft paper that i wrote today..

2011-08-12 Thread Dipankar Patro
@ Neeraj: 1+2+'4' will be very simple to calculate: 3+48+4 = 55 But 1+2+4 is a good question. On 13 August 2011 06:10, Neeraj Gupta neeraj.gupta...@gmail.com wrote: Ques 5 might be value of 1+2+'4' https://ideone.com/8b91t Obviously if we use , then it represents string and we can't define

Re: [algogeeks] Re: Quantz

2011-08-11 Thread Dipankar Patro
@ All: So this is a trick that we eventually have to know :P Where to find these tricks like these on web. Please share the links. On 12 August 2011 02:12, aditi garg aditi.garg.6...@gmail.com wrote: @aseem: using powers of 3 we have to use both sides of the balance...bt if we have the

Re: [algogeeks] O/P

2011-08-11 Thread Dipankar Patro
The question is full of errors. Provide the link, if you have copied it from somewhere. On 11 August 2011 23:53, Mani Bharathi manibharat...@gmail.com wrote: What will be the output of the following program #include int main() { int m=10,p; p=incre(incre (incre (++) incre) incre)

Re: [algogeeks] Pointer Question

2011-08-11 Thread Dipankar Patro
b. On 11 August 2011 23:20, arvind kumar arvindk...@gmail.com wrote: b. On Thu, Aug 11, 2011 at 11:18 PM, Mani Bharathi manibharat...@gmail.comwrote: int(* fun()) [row][ Col]; What should be the statement the for the above declarations a.fun() points to a two dimensional array

Re: [algogeeks] MS question

2011-08-09 Thread Dipankar Patro
Here is my code: http://ideone.com/deosU Same as that of Sagar's :D time O(n) and space O(1) On 9 August 2011 20:25, siddharam suresh siddharam@gmail.com wrote: saurabh test my program please tell me if any bug is there Thank you, Siddharam On Tue, Aug 9, 2011 at 8:18 PM, saurabh

Re: [algogeeks] output?

2011-08-09 Thread Dipankar Patro
o/p: It doesn't matter Reason: printf() returns the number of characters printed to screen. since printf() will return 0, hence the *else* is selected. On 9 August 2011 22:25, siddharth srivastava akssps...@gmail.com wrote: On 9 August 2011 22:20, tech rascal techrascal...@gmail.com wrote:

Re: [algogeeks] mcq

2011-08-08 Thread Dipankar Patro
C On 8 August 2011 17:03, ankit sambyal ankitsamb...@gmail.com wrote: 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

Re: [algogeeks] mcq

2011-08-08 Thread Dipankar Patro
Link-time it is :) On 8 August 2011 19:03, DeVaNsH gUpTa devanshgupta...@gmail.com wrote: link time -- Thanks and Regards *Devansh Gupta* *B.Tech Third Year* *MNNIT, Allahabad* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] o/p

2011-08-08 Thread Dipankar Patro
relational operators give 0/1 output; (ab) - will be either 0 or 1. similarly (a==b) will either be 0 or 1 On 8 August 2011 18:39, Anil Arya anilarya...@gmail.com wrote: in expression (ab)?a:b---(ab) returns 1 if true and 0 if (false) . On Mon, Aug 8, 2011 at 6:08 PM, dilip

Re: [algogeeks] Amazon Question

2011-08-08 Thread Dipankar Patro
1. O(n) 2. (b) On 8 August 2011 19:24, ankit sambyal ankitsamb...@gmail.com wrote: Plz give the answers ... 1. In a binary max heap containing n numbers, the smallest element can be found in time ?? 2. The number of total nodes in a complete balanced binary tree with n levels is,

Re: [algogeeks] constness in c++

2011-08-08 Thread Dipankar Patro
does the answer still remain same if you do the following: const int d=1; const int *const ptr = d; In your version I don't see ptr pointing to a const int. It just points to an integer, which I think can be changed. See if the code I suggested still does the same as your version... On 8 August

Re: [algogeeks] C easy doubt

2011-08-08 Thread Dipankar Patro
Well, a here is the address where the address of the whole 2D array is stored. with a+1 you move over the whole array in one go. So you land up with an address after the 2D array's last element. On 8 August 2011 19:59, Brijesh Upadhyay brijeshupadhyay...@gmail.comwrote: int main() { int

Re: [algogeeks] Re: Probability Puzzle

2011-08-08 Thread Dipankar Patro
3/5. As the question doesn't ask anything about the sequence. Had the question been Find the probability that all 6 are H then it would have been 17/80. On 9 August 2011 04:07, Dave dave_and_da...@juno.com wrote: @Vinay: What if you tossed 100 consecutive heads? Would that be enough to

Re: [algogeeks] shift left nd right

2011-08-08 Thread Dipankar Patro
...@gmail.com wrote: thx dipankar, its a gud 1! Bt tell me wat does '' and '' operators do? eg: 202 = 1 can u explain nd wat is this operator called? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Mon, Aug 8, 2011 at 12:54 AM, Dipankar

Re: [algogeeks] Doubts

2011-08-08 Thread Dipankar Patro
In hierarchy M1-M2 0.97 Hit = 2x0.97 = 1.94 ns M2 is not accessed in case of hit 0.03 Miss = 0.03x100 = 3ns (miss rate x miss penalty) Total = 4.94ns +1 to Aditya so the average access time is = hit + miss = 1.94 + 100.06 On 9 August 2011 08:11, Raman raman.u...@gmail.com wrote: For ques 3,

Re: [algogeeks] Doubts

2011-08-08 Thread Dipankar Patro
Sorry for the last line.. Made some error before. On 9 August 2011 08:51, Dipankar Patro dip10c...@gmail.com wrote: In hierarchy M1-M2 0.97 Hit = 2x0.97 = 1.94 ns M2 is not accessed in case of hit 0.03 Miss = 0.03x100 = 3ns (miss rate x miss penalty) Total = 4.94ns +1 to Aditya so

Re: [algogeeks] mcq

2011-08-08 Thread Dipankar Patro
ans : n + 2nk - k^2 - k On 9 August 2011 08:43, Raman raman.u...@gmail.com wrote: Yes, the answer is n + 2nk - k^2 -k -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] what is complexity of func(p)

2011-08-08 Thread Dipankar Patro
This is a simple one: get_power has a complexity of O(logb), since it is dividing b by 2 each time it is called. and the get_power func is called for p times. the overall complexity is O(plog5) , p times O(log5) On 9 August 2011 09:07, rohit rajuljain...@gmail.com wrote: int get_power(int a,

Re: [algogeeks] inorder

2011-08-06 Thread Dipankar Patro
how about using the threaded binary tree? On 6 August 2011 20:25, sagar pareek sagarpar...@gmail.com wrote: Sorry for typo mistake in prev solution 2 solutions 1. node* arr[100]; int j=0; inorder(node * ptr) { if(ptr) { inorder(ptr-left); arr[j++]=ptr;

Re: [algogeeks] Re: Printf

2011-08-05 Thread Dipankar Patro
+1 to logical address. User programs are never given access to physical address. On 5 August 2011 17:00, muthu raj muthura...@gmail.com wrote: physical adress is never acessible.Those who claim physical adress pls support ur answers. *Muthuraj R IV th Year , ISE PESIT , Bangalore*

Re: [algogeeks] Question

2011-08-05 Thread Dipankar Patro
try doing this way and tell if the program is working properly now: for (i=0; i3; i++) { scanf(%[^\n], e[i].name); scanf(%f, e[i].sal); } There is always some problem in string input using %s, don't really know why though deeply. On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com

Re: [algogeeks]

2011-08-05 Thread Dipankar Patro
Try a dry run on the following linked list 1-2-3-4-5-6-Null head is a global variable; The recursion will take place till 6 and assign head address of 6; then it will first change 5-6-(back to 5) [root-next-next = root] when it will be back to 4, change 4-5-(back to 4) . at this stage the

Re: [algogeeks] pointer size

2011-08-04 Thread Dipankar Patro
is 4 bytes. so tell me where im interpreting wrong? Shashank Jain 3rd year, Computer Engg. Delhi College of Engineering On Thu, Aug 4, 2011 at 11:16 AM, Dipankar Patro dip10c...@gmail.comwrote: This has been a hot topic of discussion for a long time. But I found there are two things

Re: [algogeeks] pointer size

2011-08-04 Thread Dipankar Patro
, processor, compiler ? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Thu, Aug 4, 2011 at 11:57 AM, Dipankar Patro dip10c...@gmail.comwrote: there absolutely nothing wrong in your interpretation. here is a link that might help : http://www.unix.org

Re: [algogeeks] pointer size

2011-08-04 Thread Dipankar Patro
Yeah. On 4 August 2011 12:14, N1teesh nitee...@gmail.com wrote: So if either of the OS , Compiler , Processor are 32 Bit , then the size is bound to be 4 bytes? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on

Re: [algogeeks] pointer size

2011-08-04 Thread Dipankar Patro
Also, you must remember that 64 OS can never run 32 bit Processors, since it will require a 64 bit CPU to produce a 64bit address format On 4 August 2011 19:19, Dipankar Patro dip10c...@gmail.com wrote: Yeah. On 4 August 2011 12:14, N1teesh nitee...@gmail.com wrote: So if either of the OS

Re: [algogeeks] Re: Amazon Aptitude questions

2011-08-04 Thread Dipankar Patro
Kashish, I think it won't work. The correct is: ls -R | grep .java On 4 August 2011 20:17, kashish jain kashish.jain.n...@gmail.com wrote: answer to shell command is grep -r *.java i wanted to ask , am i right ? On Thu, Aug 4, 2011 at 2:16 PM, Shashank Jain shashan...@gmail.comwrote:

Re: [algogeeks] OS question

2011-08-04 Thread Dipankar Patro
I think the answer would be the thread calling execute will have to wait for the executed command to exit and then it will proceed. As for other threads, they shouldn't be affected. Please do correct me if it is wrong. On 4 August 2011 20:27, ankit sambyal ankitsamb...@gmail.com wrote: What

Re: [algogeeks] Why this is giving run time error ?

2011-08-04 Thread Dipankar Patro
logic On Thu, Aug 4, 2011 at 11:10 AM, Dipankar Patro dip10c...@gmail.comwrote: Well I think the reason is very simple: When you enter the loop through L, the value of i is not initialized to 0, it is some garbage value. now while exiting the loop, the condition is checked for another

Re: [algogeeks] Why cant structures be declared or defined in C but can be done in C++ ?

2011-08-04 Thread Dipankar Patro
Structures can very well be declared in C: struct student{ char name[20]; int roll; }s1; Are you talking about Classes? On 4 August 2011 23:51, Ankur Garg ankurga...@gmail.com wrote: Why cant structures be declared or defined in C but can be done in C++ ? What is the reason for this

Re: [algogeeks] Largest Bst in a binary tree.

2011-08-04 Thread Dipankar Patro
you, Siddharam On Fri, Aug 5, 2011 at 10:00 AM, Aman Goyal aman.goya...@gmail.comwrote: while dequing a node from the queue, how will u check whether a bst property is sattisfied or not ?.. On Fri, Aug 5, 2011 at 9:49 AM, Dipankar Patro dip10c...@gmail.comwrote: I have some upto

Re: [algogeeks] Largest Bst in a binary tree.

2011-08-04 Thread Dipankar Patro
, 2011 at 10:00 AM, Aman Goyal aman.goya...@gmail.comwrote: while dequing a node from the queue, how will u check whether a bst property is sattisfied or not ?.. On Fri, Aug 5, 2011 at 9:49 AM, Dipankar Patro dip10c...@gmail.comwrote: I have some upto this much currently. Modify the Breadth

Re: [algogeeks] pointer size

2011-08-03 Thread Dipankar Patro
This has been a hot topic of discussion for a long time. But I found there are two things to look into it: 1. a 64 bit OS is one, which has 64 bit address handling capacity. and a 64bit processor is one which can perform operations on 64 bit data. A general concept that actually gets overlooked

Re: [algogeeks] Re: reason?????????

2011-08-01 Thread Dipankar Patro
1. When you are using %u, it is for unsigned printing. 2. looking at the loop, it will run for only values of i for(i=5 i=-1;++i;i0) ^^ the first statement here is not the conditional one. 3. since int is of 4 bytes on your system, the max positive value it will print is power(2, 32) - 1. (4

Re: [algogeeks] Re: ADT

2011-08-01 Thread Dipankar Patro
No. It is a basic data type which is used to make an ADT. I don't know whether you have gone through this link, but I think it has explained it properly http://www.dba-oracle.com/t_object_encapsulation_abstract.htm On 1 August 2011 23:01, Priyanka pril...@gmail.com wrote: On Aug 1, 9:19 pm,

Re: [algogeeks] ADT

2011-08-01 Thread Dipankar Patro
Well, To understand it better, do you know about data abstraction in C++? Its the hiding of data and programs implementations and just let you know what the program does. Similarly ADT are similar to normal data types, with their own functions associated with them. To use ADT you need not know

Re: [algogeeks] Graph Based Problems

2011-07-26 Thread Dipankar Patro
Love your idea Navneet, but I have seen in general that Graph algos are difficult to convert into code (at least for me!) May be that's the reason why people are not discussing it here. But like you pointed out we could at least point the scenarios where graph algos can be applied. Looking

Re: [algogeeks] C Output

2011-07-25 Thread Dipankar Patro
Swetha, '\' in C is used to denote a escape sequence in C strings (and also in many other languages). e.g '\n' is for New Line '\n' is counted as one character. Now '\ooo' is for an ASCII in octal representation. here is the list of all escape sequences:

Re: [algogeeks]

2011-07-25 Thread Dipankar Patro
Puneet, you missed out the 'sorted' part of array. Your code works fine for randomized array. +1 to Manish's solution. I had the same algo :) On 26 July 2011 00:33, Puneet Gautam puneet.nsi...@gmail.com wrote: let k=a+b run in two loops for(i=0;((in) (a[i]k));i++)

Re: [algogeeks] C - pre post increment

2011-07-21 Thread Dipankar Patro
Certainly Aman. The concepts of pre and post increment still stand correct. while (x = --x) will terminate after x = 1 and when encountered (x = --x) = x = 0 (after testing condition). Thus, 0 will not be printed. while (x = x--) will terminate after x = 0 and when encountered (x = x--) = x= -1