Re: [algogeeks] Immediate interview ASP.Net/Silverlight Developer -- NY

2011-03-10 Thread Pramod Negi
you guys going to get everone from this group only? On Fri, Mar 11, 2011 at 12:11 AM, Sam Riley wrote: > Dear Folks, > Wishes for the Day !!! > We Need consultant for ASP.Net/Silverlight Developer > Please share suitable profiles to s...@panzersolutions.com > > *Job Title : ASP.Net/Silverlight

Re: [algogeeks] Doubly linklist to Singly linklist...........

2010-08-07 Thread Pramod Negi
Search XoR List on Wiki On Sun, Aug 8, 2010 at 10:19 AM, UMESH KUMAR wrote: > how to convert Doubly Link list to a Singly link list without changes > the Structure of the list if possible or not ,if possible then try to > discus of that problem. > > > thanks and Regards > Umes

Re: [algogeeks] Re: Find the duplicate

2010-08-07 Thread Pramod Negi
Already posted compare pair wise i.e a[0] and a[1]a[2] and a[3].. leave out last 4 elements... repeated element can be found in 3 comparison for these 3 elements... total no of comparison in worst case (n/2+1) Thanks Pramod Negi On Sat, Aug 7, 2010 at 7:14 PM, ankur bhardwaj wrote: >

Re: [algogeeks] Find the duplicate

2010-08-05 Thread Pramod Negi
compare pair wise i.e a[0] and a[1]a[2] and a[3].. leave out last 4 elements... repeated element can be found in 3 comparison for these 3 elements... total no of comparison in worst case (n/2+1) Negi On Thu, Aug 5, 2010 at 10:55 PM, Shiv ... wrote: > In constant space??? How? will you p

Re: [algogeeks] Permutation.................

2010-08-01 Thread Pramod Negi
http://pramnegi.blogspot.com/2009/11/dons-permutaion.html Thanks Pramod Negi On Sun, Aug 1, 2010 at 4:30 PM, UMESH KUMAR wrote: > Write a C code for generate all possible Permutation > as:- 1 2 3 > Total no. of Per=6 > also print all permutation > as:- 1 2 3 >1 3

Re: [algogeeks] number of BST's

2010-07-29 Thread Pramod Negi
Follow up on Catalon Nubmer... On Fri, Jul 30, 2010 at 10:44 AM, Amit Jaspal wrote: > n is clearly a number lets say 3 then BST's with 1,2,3 values as key are to > be calculated > > > On Fri, Jul 30, 2010 at 9:08 AM, Apoorve Mohan wrote: > >> @AMIT: what does "n" represents? >> >> >> On Fri, Jul

Re: [algogeeks] Re: sort 0's 1's and 2's

2010-07-03 Thread Pramod Negi
3 pointers temp0 = first non 0 from start temp2 = first non 2 from end temp1 = temp0 loop till temp1 < temp2 if temp1 ==0 swap a[temp1] a[temp0] temp0++ if temp1 == 2 swap a[temp1] a[temp2] temp2-- if temp1==1 temp1++ end On Fri, Jul 2, 2010 at 8:16 AM, Gene wrote: >

Re: [algogeeks] 2_D matrix

2010-07-03 Thread Pramod Negi
Young's Tableau.. go along non-major diagonal in a stair up or down fashion On Fri, Jul 2, 2010 at 11:46 PM, Amir hossein Shahriari < amir.hossein.shahri...@gmail.com> wrote: > @Rahul: the worst case running time for your algo is O(nlogn) > > but here's another approach: > suppose we're searchin

Re: [algogeeks] Re: rotation

2010-07-03 Thread Pramod Negi
I guess you want the following juggling algorithm http://www.cs.bell-labs.com/cm/cs/pearls/s02b.pdf On Fri, Jul 2, 2010 at 11:16 PM, Dave wrote: > @Jalaj. The original poster said, "P.S---do not give block reversal > method for array rotation " > > Dave > > On Jul 2, 10:54 am, jalaj jaiswal

Re: [algogeeks] amazon question

2010-07-03 Thread Pramod Negi
if it means storing it in a file, store at 2i and 2i+1 location and NULL if some child doesn't exists On Sat, Jul 3, 2010 at 7:42 PM, ashish agarwal wrote: > We can do 4 type of treversal. > If we do inorder then we will get sorted array .If we do an inorder > traversal then we would get a sorte

Re: [algogeeks] array

2010-07-03 Thread Pramod Negi
Median Can be found out in O(n) times (kth order statistic) On Sat, Jul 3, 2010 at 4:46 PM, Akash Gangil wrote: > Hi Amir > > On Fri, Jul 2, 2010 at 10:13 PM, Amir hossein Shahriari < > amir.hossein.shahri...@gmail.com> wrote: > >> both problems can be done in O(n) >> pick the first two element

Re: [algogeeks] Re: ds

2010-06-13 Thread Pramod Negi
Hello All, What every algorithm mentioned above have some problem. The Recursive swapping won’t work if you don’t have 2^n elements. Same with getting the indexes, it will form a cycle. Thanks Pramod Negi On Fri, Jun 11, 2010 at 7:09 PM, sharad kumar wrote: > excellent s

Re: [algogeeks] Re: bits

2010-06-13 Thread Pramod Negi
>From last few days I'm seeing the question that is coming here is not algorithm specific. Purpose of this group is achieved or defeated??? Thanks Pramod Negi On Sun, Jun 13, 2010 at 9:48 PM, jalaj jaiswal wrote: > hey i too have a doubt... and its just 1 ... i'll not ask c/c++

Re: [algogeeks] Where does OS scheduling run??

2010-05-17 Thread Pramod Negi
Hello, There exists differnet google groups for OS related queries. Could you please move out your discussion there. Thanks Pramod Negi On Thu, May 6, 2010 at 5:34 AM, Yalla Sridhar wrote: > yea if your processor has multiple cores or is Hyper Threading support then > it can e

Re: [algogeeks] Why is inorder traversal necessary to reconstruct a binary tree?

2010-04-08 Thread Pramod Negi
why only Preorder and Postorder is not suffice. consider Two Binary Tree Root = A Left Chid = B Preorder: A,B Postorder: B,A and Root = A Right Child = B Preorder: ,A,B Postorder: B,A for given preorder and postorder two different binary trees can be formed Thanks Pramod Negi On Thu, Apr

Re: [algogeeks] Finding youngest common ancestor of two nodes in a binary tree

2010-04-07 Thread Pramod Negi
could you please elucidate more?? On Wed, Apr 7, 2010 at 10:34 PM, Himanshu Aggarwal wrote: > For a given binary tree, given the root and two node pointers, how can we > find their youngest common ancestor. > > Say the node is like: > > struct node{ >int data; >struct node*left, *

Re: [algogeeks] Convert a BST into sorted doubly linked list...

2010-03-28 Thread Pramod Negi
This is the best description. http://cslibrary.stanford.edu/109/TreeListRecursion.html Thanks Pramod Negi On Sun, Mar 28, 2010 at 1:39 PM, Piyush Verma <114piy...@gmail.com> wrote: > How can we convert a BST into a sorted doubly linked list? > i have the solution that i tra

Re: [algogeeks] Re: Largest span of Increasing Pair in an array

2010-03-15 Thread Pramod Negi
Mar 14, 2010 at 8:49 PM, Ralph Boland wrote: > >> >> On Mar 14, 7:46 am, ASHISH MISHRA wrote: >> > @ankur how u can solve it in o(n) >> > i suppose u need atleast o(n lgn) >> > >> > On Sun, Sep 6, 2009 at 2:52 PM, ankur aggarwal < >> a

[algogeeks] Re: second highest elemt in an aary

2009-09-28 Thread Pramod Negi
It won't try with [1,3,2] On Mon, Sep 28, 2009 at 11:56 AM, harit agarwal wrote: > It will take n comparisons.observe this code > > > #include > using namespace std; > int sec_largest(int ar[],int n) > { > int i,max=-32767,sec_max=0; > for(i=0;i { >

[algogeeks] Re: second highest elemt in an aary

2009-09-27 Thread Pramod Negi
This will,I guss take 3N/2 comparison, for N + Lg -2. Find Max(Winner) in N-1 (Tournament Method) Compare Looser(fron Winner) For every Round with The Looser(from Winner) of previous round.. _Negi highest2=a[1]; > for(i=1;i<5;i++) > { > if( a[i] > highest1) > { > highest2 = highest1; > high

[algogeeks] Re: Largest span of Increasing Pair in an array

2009-09-06 Thread Pramod Negi
i guess sorting will do the work. any other constraint?? On Sun, Sep 6, 2009 at 9:52 AM, p0r$h <1987.shis...@gmail.com> wrote: > > Given an array of integers A[N], find the maximum value of (j-k) such > that A[k] <= A[j] & j>k. > I am looking for a solution with time complexity better than O(N^2)

[algogeeks] Re: swap every two bits in the byte..

2009-09-05 Thread Pramod Negi
i guess num = ((num&0xAA)>>1) | ((num&0x55)<<1)) will work Negi On Sat, Sep 5, 2009 at 2:08 PM, Gokul wrote: > > how ll u swap every two bits in the a byte??? can anyone help me??? > for eg. > consider a byte as input... > 10111010 > > output should be > 01110101 > > it exactly swap the two bit

[algogeeks] Re: Find an element in sorted matrix

2009-08-20 Thread Pramod Negi
I guess it is famous "Younge Tableau" Problem of tableau MxN and searching can be done in O(M+N). I doubt the problem can be solved in O(lgn) if no space constraint and no pre-processing constraint present. On Thu, Aug 20, 2009 at 9:42 PM, Anil C R wrote: > A more general problem is discussed in

[algogeeks] Re: bits required to convert A to B

2009-08-16 Thread Pramod Negi
i guess XORing A and B and count the no of set bits will do. On Sun, Aug 16, 2009 at 11:09 PM, richa gupta wrote: > > Given two integers A & B. Determine how many bits required to convert > A to B.how to write a function int BitSwapReqd(int A, int B); > > -- > Richa Gupta > (IT-BHU,India) > > >

[algogeeks] Re: splay tree

2008-10-01 Thread Pramod Negi
provide some good pointer to me also On Wed, Oct 1, 2008 at 8:40 PM, Nuda LU <[EMAIL PROTECTED]> wrote: > any one familiar with splay tree? I am kind of confused why bother to have > such complicated step like zig-zig, zag-zag, zig-zag or zag-zig to have the > Amortized time 3 log{W/w(i)}+ 1.

[algogeeks] Re: selection problem.....

2008-04-22 Thread Pramod Negi
er elements comes to the left side and > larger elements comes to the right side? Kindly explain in detail. > > 2008/4/22 Pramod Negi <[EMAIL PROTECTED]>: > > > i didnt get what u want to so say (the bold lines) > > > > On 4/21/08, Dave <[EMAIL PROTECTED]> wro

[algogeeks] Re: selection problem.....

2008-04-21 Thread Pramod Negi
i didnt get what u want to so say (the bold lines) On 4/21/08, Dave <[EMAIL PROTECTED]> wrote: > > > Use a divide-and-conquer algorithm to find the median, rearranging the > array so that the values less than the median precede it in the array > and the values greater than the median follow it. So

[algogeeks] Re: Discussion on unique-elements-in-an-array

2007-11-09 Thread Pramod Negi
p://en.wikipedia.org/wiki/Heapsort#Comparison_with_other_sorts > > On Nov 9, 3:54 pm, "Pramod Negi" <[EMAIL PROTECTED]> wrote: > > which algo sort array in O(N lgN) without extra space?? > > > > On 11/6/07, Andrey <[EMAIL PROTECTED]> wrote: &g

[algogeeks] Re: Discussion on unique-elements-in-an-array

2007-11-09 Thread Pramod Negi
which algo sort array in O(N lgN) without extra space?? On 11/6/07, Andrey <[EMAIL PROTECTED]> wrote: > > > dor is absolutely right > > > O(N*log(N)) is straightforward.. sort the array in O(N*log(N)) and > > then remove duplicates in linear time. > > it doesn't need any extra memory. > > > >

[algogeeks] Re: Removing a set of characters from a given string

2007-10-04 Thread Pramod Negi
Use bit array rather using array of size 26 On 9/15/07, Deva R <[EMAIL PROTECTED]> wrote: > > > > a linear solution. > > - initialize an array of 26 (count for each character) with zeros. > - scan pattern array and toggle equivalent alphabet's occurance field > - scan subject string and skip occur

[algogeeks] Re: Height of a binary tree

2007-04-18 Thread pramod negi
I think this always return height 1. isn't it On 4/17/07, BiGYaN <[EMAIL PROTECTED]> wrote: > > > We will be calling the function like : > height = getheight(root); > > and here's the function defination : > int getheight ( node *p ) > { >if ( p==NULL ) >return 0; >else >rh

[algogeeks] Re: spiral matrix..

2007-02-06 Thread pramod negi
The way u print a matrix in spiral order, same logic u can use to form the matrix from given input PROVIDED the order of matrix is given ... and this can be done in O(m x n) complexity... --Negi --~--~-~--~~~---~--~~ You received this message because you ar

[algogeeks] Re: the sum of two unsigned integers

2007-02-06 Thread pramod negi
> > > > i think to check whethere the result is overflowed or not check if ((A+B) -A is not equal to B) printf("Overflow"); correct in if i m wrong --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google