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 wro

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 28,

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: 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, e

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 goo

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 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 wrote: > >> 16 >> >> 8*(8-1*(8-1-1)) >> >> >> Sanju >> :) >> >> >> >> On Sun, Aug 21, 2011

Re: [algogeeks] Syllogism

2011-08-20 Thread Dipankar Patro
yes, i think so On 20 August 2011 10:52, sukran dhawan wrote: > yes > > > On Sat, Aug 20, 2011 at 10:26 AM, geek_one > wrote: > >> Statement: Some girls are beautiful. >> Conclusion: Some girls are not beautiful. >> >> is the conclusion is true on the basis of Statement? >> >> -- >> You receive

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
resp. in > the Inorder traversal of the tree.) > > On Sat, Aug 20, 2011 at 12:46 PM, Dipankar Patro wrote: > >> 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 o

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; find_min_diff(

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] query.. amazon question

2011-08-19 Thread Dipankar Patro
is not specified.. > > thx, > --Gopi > > > On Sat, Aug 20, 2011 at 9:25 AM, Dipankar Patro wrote: > >> Fixed the problem. There was a problem with the first element positioning. >> >> Here is the final solution: >> http://ideone.com/XwymV >> >> ^^

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 wrote: > http://ideone.com/ucO4d > > Total no. of elements shoul

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 wrote: > this was earlier in this group... > Please see this paper: http://j.mp/rtNp4W > > > On

Re: [algogeeks] important question on ADT

2011-08-19 Thread Dipankar Patro
(c) On 19 August 2011 23:18, sukran dhawan 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 wrote: > >> An abstract data type is >> (a) same as abstract class >> (b) a datatype that cannot be instanti

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 wrote: > > > On 19 August 2011 00:31, priya ramesh wrote: > >> it can remove methods defined in base class as well?? By overriding a >> virtual

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 (provide

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 wrote: > We should return curr->next in the last statement of ur code > > On Aug 18, 7:08 am, Dipankar Patro wrote: &

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

2011-08-17 Thread Dipankar Patro
Interesting thing I came across: http://stackoverflow.com/questions/1239938/c-accesses-an-array-out-of-bounds-gives-no-error-why On 18 August 2011 09:39, vartika aggarwal wrote: > Is it that there is no bounds checking in C while there is in C++ ? > > > On Thu, Aug 18, 2011 at 9:27

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 wrote: > @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 at 8:47 AM, aditi garg w

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 wrote: > How ma

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 wrote: > I have come up with this: > - Use only one pointer, NODE *cur > - initi

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 w

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 wrote: > Agree with Sandeep :) > Try this link http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes. > Hope it helps :) > > > Sanjay Kumar > B.Tech Final Year > Department of Compute

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 wrote: > string str = "i am a programmer" > for(int i = 0; i < str.size()/2; i ++) > swap(str[i], str[str.size()-i-1]); > time complexity O(n

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] 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 (a&b)and also as address operator(&b). Not sure about '#', haven't used much. On 15 August 2011 18:45, aditi garg wrote: > Pick the operators whose meaning is context dependent? > 1. * > 2.#

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 r

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 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 access > to a comm

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 wrote: > I think dis is bec int occupies 4 bytes while char occupies 1 byte so in

Re: [algogeeks] Todays PEP question

2011-08-14 Thread Dipankar Patro
3. On 15 August 2011 01:07, rajeev bharshetty 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 (2>2) > So t is incremented only 3 times. > > > On Mon, Aug 15, 2011 at 12:44 AM, aditi garg wrote: >

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 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 it circularly)

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

2011-08-14 Thread Dipankar Patro
You are correct. The answer, like the answer to so many > questions, is "It depends." > > Dave > > On Aug 14, 1:11 pm, Dipankar Patro wrote: > > Hi all, > > > > I have come across quite a few questions like > > " > > What is the way in w

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

[algogeeks] Storing of data in memory (endianness)

2011-08-14 Thread Dipankar Patro
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 0 0 0 or 0 0 0 2 " Doesn't the answer depend upon the machine you are working on? I mean both are perfectly possible situations if you see. First option is little-endian, second o

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 wrote: > fibonacci series...??? > > --

Re: [algogeeks] Re: array question

2011-08-14 Thread Dipankar Patro
nt 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 wrote: > > @ Sagar: > > What if extra sp

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 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 > whether its compi

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

2011-08-14 Thread Dipankar Patro
/\ >> 2 10 >> / \ >>13 >> successor of 3 shall be 4 not 2.. >> >> >> On Fri, Aug 12, 2011 at 4:48 PM, ashmantak wrote: >> >>> @Dipankar Patro - >>> >>> The figure u have made isn'

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 wrote: > Hashing > O(n+m) > > > On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro wrote: > >> how about binary search of each element

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 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 wrote: > >> mea

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 wrote: > MVIT ? > > On Sat, Aug 13, 2011 at 9:02 PM, Dipankar Patro wrote: > >> Which college? >> >&

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 1

Re: [algogeeks] de shaw

2011-08-13 Thread Dipankar Patro
Which college? On 13 August 2011 20:52, ravinder s wrote: > > > hi can anyone tell me the pattern of de shaw ? > > -- > 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 un

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 wrote: > wonderful :) > > > On Sat, Aug 13, 2011 at 6:30 PM, Rahul wrote: > >> lol++ >> Rahul >> >> >> On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH >> wrote: >> >>> lol >>> >>> >>> On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani < >>>

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 wrote: > > is printing a n*n array,spirally is same as printing it helicall

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] 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 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 + > operation with

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 year.

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 a

Re: [algogeeks] Pointer Question

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

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 wrote: > What will be the output of the following program > #include > int main() > { > int m=10,p; > p=incre(incre (incre (++) incre) incre) > Printf("%d", *&P); > retu

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 wrote: > @aseem: using powers of 3 we have to use both sides of the balance...bt if > we have the constraint dat we can use only

Re: [algogeeks] amazon help

2011-08-11 Thread Dipankar Patro
Topcoder will be a good option. Amazon mainly makes you write functions in which the parameters and structure of any user defined data types are clearly mentioned. Just coding on a normal computer will also help. Suggestion: Make sure you are accustomed with Tree programs, On 12 August 2011 06:

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 wrote: > > > On 9 August 2011 22:20, tech rascal wrote: > >> #include >> int main() >> { >> cha

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 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 singh wrote: >

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 wrote: > int get_power(int a, int b) > { > if(!b) >

Re: [algogeeks] mcq

2011-08-08 Thread Dipankar Patro
ans : n + 2nk - k^2 - k On 9 August 2011 08:43, Raman 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 > https://groups.google.com/d/msg/algogeeks

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 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

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 wrote: > For ques 3, remember that con

Re: [algogeeks] shift left nd right

2011-08-08 Thread Dipankar Patro
> >>> > thx dipankar, its a gud 1! > >>> > Bt tell me wat does '<' and '>' operators do? > >>> > eg: 20>2 = 1 > >>> > can u explain nd wat is this operator called? > >>> > Shashank Jain >

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 wrote: > @Vinay: What if you tossed 100 consecutive heads? Would that be enough > to convince you that you ha

Re: [algogeeks] sizeof operator C..

2011-08-08 Thread Dipankar Patro
Try searching a bit on the group before posting. This has been already discussed a couple of times on this group itself. a is an array of 2 integers, thus sizeof(a) = 2*size of(int) = 8 &a is the address where the the address of the array is stored. Thus sizeof(&a) = sizeof(*pointer*) = 4 bytes(on

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 wrote: > int main() > { >int a[3][4]={1,2,3,4,5,6,7,8,

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] Amazon Question

2011-08-08 Thread Dipankar Patro
1. O(n) 2. (b) On 8 August 2011 19:24, ankit sambyal 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, > a)3^n + 1 > b)

Re: [algogeeks] o/p

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

Re: [algogeeks] mcq

2011-08-08 Thread Dipankar Patro
Link-time it is :) On 8 August 2011 19:03, DeVaNsH gUpTa 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 post to this gr

Re: [algogeeks] mcq

2011-08-08 Thread Dipankar Patro
C On 8 August 2011 17:03, ankit sambyal 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 > algogeeks+unsubscr

Re: [algogeeks] shift left nd right

2011-08-07 Thread Dipankar Patro
This link I think is a good one: http://msdn.microsoft.com/en-us/library/336xbhcz.aspx On 8 August 2011 00:37, Shashank Jain wrote: > plz sum1 explain me shift left nd shift right operators? > > Shashank Jain > IIIrd year > Computer Engineering > Delhi College of Engineering > > -- > You receiv

Re: [algogeeks] inorder

2011-08-06 Thread Dipankar Patro
how about using the threaded binary tree? On 6 August 2011 20:25, sagar pareek 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; > inorder(pt

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 sta

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; i<3; 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 wrote: > But program

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 wrote: > physical adress is never acessible.Those who claim physical adress pls > support ur answers. > *Muthuraj R > IV th Year , ISE > PESIT , Bangalore* > > > > > On Fri, Aug

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

2011-08-04 Thread Dipankar Patro
> traversal thats the *'largest BST in a binary tree.'* " > > > > Thank you, > > > > Siddharam > > > > > > On Fri, Aug 5, 2011 at 10:00 AM, Aman Goyal > > > wrote: > > > > > while dequing a node from the queue, ho

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

2011-08-04 Thread Dipankar Patro
thats the *'largest BST in a binary tree.'* " >>> Thank you, >>> Siddharam >>> >>> >>> >>> On Fri, Aug 5, 2011 at 10:00 AM, Aman Goyal wrote: >>> >>>> while dequing a node from the queue, how will u check

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

2011-08-04 Thread Dipankar Patro
st BST in a binary tree.'* " >> Thank you, >> Siddharam >> >> >> >> On Fri, Aug 5, 2011 at 10:00 AM, Aman Goyal wrote: >> >>> while dequing a node from the queue, how will u check whether a bst >>> property is sattisfied or not ?.. >

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

2011-08-04 Thread Dipankar Patro
gt; On Fri, Aug 5, 2011 at 9:35 AM, Dipankar Patro wrote: > >> The question is a bit tricky. >> Is it possible that the largest BST is somewhere in deeper depth, i.e. it >> is not necessarily consisting of the root? >> >> On 5 August 2011 08:46, Aman Goyal wrote: &

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

2011-08-04 Thread Dipankar Patro
The question is a bit tricky. Is it possible that the largest BST is somewhere in deeper depth, i.e. it is not necessarily consisting of the root? On 5 August 2011 08:46, Aman Goyal wrote: > How to find the largest BST in a binary tree. > > > > 15 > / \ > 10__ 20 > / \ > 5 _7 > /

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 wrote: > Why cant structures be declared or defined in C but can be done in C++ ? > > > What is the reason for this ? > > -- > You r

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

2011-08-04 Thread Dipankar Patro
hu, Aug 4, 2011 at 11:10 AM, Dipankar Patro wrote: > >> 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] 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 wrote: > What happens when a thread ca

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 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 wrote: > >> whats the priority of ^ symbol? >> >> S

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 wrote: > Yeah. > > On 4 August 2011 12:14, N1teesh wrote: > >> So if either of the OS , Compiler

Re: [algogeeks] pointer size

2011-08-04 Thread Dipankar Patro
Yeah. On 4 August 2011 12:14, N1teesh 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 the web vis

Re: [algogeeks] pointer size

2011-08-03 Thread Dipankar Patro
l 3 : OS, processor, compiler ? > > Shashank Jain > IIIrd year > Computer Engineering > Delhi College of Engineering > > > > On Thu, Aug 4, 2011 at 11:57 AM, Dipankar Patro wrote: > >> there absolutely nothing wrong in your interpretation. >> here is a link th

Re: [algogeeks] pointer size

2011-08-03 Thread Dipankar Patro
o 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 wrote: > >> This has been a hot topic of discussion for a long time. But I found there >>

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 by

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

2011-08-03 Thread Dipankar Patro
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 iteration. Since the value of i is unknown, it might be the case that i= j. On 4 August 2011

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 how

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;i>0) ^^ 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. (

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 wrote: > > > On Aug 1, 9:19 pm, pandharinath go

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 forward

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 wrote: > let k=a+b > > run in two loops > > for(i=0;((i for(j=i+1;a[j]<=(k-a[i]);j++) > if(

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: http://msdn.microsoft.com/en-us/library/h21

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= -