[algogeeks] Re: DS Q

2011-11-17 Thread shady
you can't do binary search with linked lists. On Nov 17, 1:14 pm, Vijay Khandar vijaykhand...@gmail.com wrote: Linked lists are not suitable data structures of which one of the following problems? a) Insertion sort b) Binary search c) Radix sort d) Polynomial manipulation Plz explain

Re: [algogeeks] DS Q

2011-11-17 Thread Piyush
b) Binary search Binary search has to be done in O(logn) but in a linked list individual elements can't be accessed in O(1) time. and hence its not suitable to have a linked list as a data structure in binary search. -- You received this message because you are subscribed to the Google Groups

[algogeeks] Re: Re-entrant and thread safe

2011-11-17 Thread sumit mahamuni
On Oct 29, 10:44 pm, AMAN AGARWAL mnnit.a...@gmail.com wrote: Hi All, Please explain the difference between thread safe functions and re-entrant functions with example. Thread safe function is the function if it ensures that it is the only thread which modifies the shared data structure in

Re: [algogeeks] Re: DS Q

2011-11-17 Thread sumit mahamuni
On Thu, Nov 17, 2011 at 4:05 PM, shady sinv...@gmail.com wrote: you can't do binary search with linked lists. Yes you can do the binary search on the linked list. But the only difference it makes from the array is that array elements can be accessed in O(1) time and finding the mid in array is

Re: [algogeeks] Re: DS Q

2011-11-17 Thread shady
roflmao, that's what i mean, else the whole purpose of binary search is defeated, instead just linearly traverse the array and find the element On Thu, Nov 17, 2011 at 4:17 PM, sumit mahamuni sumit143smail...@gmail.comwrote: On Thu, Nov 17, 2011 at 4:05 PM, shady sinv...@gmail.com wrote:

Re: [algogeeks] DS Q

2011-11-17 Thread Vijay Khandar
Thank u very much On Thu, Nov 17, 2011 at 4:05 PM, Piyush piyushmadan2...@gmail.com wrote: b) Binary search Binary search has to be done in O(logn) but in a linked list individual elements can't be accessed in O(1) time. and hence its not suitable to have a linked list as a

[algogeeks] Programming Question

2011-11-17 Thread Vijay Khandar
In the following Pascal Program segment what is the value of X after the execution of the program segment? X:=10; Y:=20; If XY,then if X0 then X:=abs(X) else X:=2*X; Plz anyone explain -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: spoj problem

2011-11-17 Thread Anshul AGARWAL
finally got AC,(using bfs) thanx DON for provide such nice test case *Anshul Agarwal Nit Allahabad Computer Science** * On Wed, Nov 16, 2011 at 8:14 PM, SAMMM somnath.nit...@gmail.com wrote: U need to check for the case when (s==g) source and destination are same , I got stuck here , after

[algogeeks] Re: COA Question

2011-11-17 Thread Dave
d) Formal parameters, because they are in the definition of the macro. If they were in an invocation of a macro, they would be actual parameters, as in ADD a,b a and b are actual parameters, and the macro expands as LOAD b MUL a STORE b Where each instance of a formal parameter

Re: [algogeeks] array searching

2011-11-17 Thread SAMM
Yes we can do so in O(n) . First find the XOR of all unique elements using hash table or some other DS. Secondly XOR all the elements of the array .which will hav the xor of elements other thn the element repeated twice. Now XOR the above two value which will give the answer.. On 11/17/11,

[algogeeks] Re: Programming Question

2011-11-17 Thread icy`
I dont know Pascal too well, but to me it looks like nested if statements. If xy , all the rest of it happens Since x is not greater than y, nothing happens. So x and y should remain the same (10,20) On Nov 17, 6:09 am, Vijay Khandar vijaykhand...@gmail.com wrote: In the following Pascal

Re: [algogeeks] [JOB] Referral program @InMobi

2011-11-17 Thread shady
dont post here, send a mail to the raunak, we don't allow such threads, but i thought it will benefit some of you, so allowed it. On Thu, Nov 17, 2011 at 11:05 PM, Raunak Agrawal raunak.ra...@gmail.comwrote: Hi All, Please find the job description attached and let me know if anyone is

[algogeeks] Re: array searching

2011-11-17 Thread Dave
@SAMM: It sounds like a circular argument. How do you XOR all of the unique elements without first finding the repeated ones? Dave On Nov 17, 11:24 am, SAMM somnath.nit...@gmail.com wrote: Yes we can do so in O(n) . First find the XOR of all unique elements  using hash table or some other DS.

[algogeeks] Re: Binary Trees and BSTs

2011-11-17 Thread bugaboo
Given 'n' nodes, # of possible BTs = (2^n)-n # of possible BSTs - Catalan number Cn = (2n!)/(n!*(n+1)!) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

[algogeeks] Re: Computer Organisation Q

2011-11-17 Thread ((** VICKY **))
False not necessarily. On Nov 17, 4:03 pm, Vijay Khandar vijaykhand...@gmail.com wrote: Can anyone explain following sentence- True or False and explain All instructions affect the flags Vijay Khandar... -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: array searching

2011-11-17 Thread SAMM
On 11/18/11, SAMM somnath.nit...@gmail.com wrote: For example the array has .. 1 4 2 6 7 4 8 3.. xor the elements in the array will give (1^2^6^7^8^3). now xor the unique elements using hash table ,It gives (1^4^2^6^7^8^3). Now xor these two value which gives 4. On 11/18/11, Dave

[algogeeks] deep vs shallow copy

2011-11-17 Thread rahul sharma
plz give me xample of these two .as per from book m not able to get thesw clearly,...i have reda from wiki and got it but cant relate with these...plz differ b/w these two with xample..thnx in advance a shallow copy of an object copies all the member field values.this works well if the

[algogeeks] Re: deep vs shallow copy

2011-11-17 Thread Gene
The most extreme shallow copy is just copying a pointer to a large data structure like a graph or tree. Deep copy is copying the entire data structure and returning a new pointer. Here is a more common example: typedef struct list { struct list *next; void *data; } LIST_NODE; In practice