Re: [algogeeks] Directi Interview Ques

2012-07-10 Thread Akshat Sapra
Here you have to first sort both the arrays A and B and merge both the arrays to form the sorted array C -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) *--* sapraaks...@gmail.com akshatsapr...@gmail.com rit20009008@ rit20009

[algogeeks] Directi question

2012-07-09 Thread Akshat Sapra
to output the minimum number of jumps that can be made from starting position to end position of an array. -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) *--* sapraaks...@gmail.com akshatsapr...@gmail.com rit20009008@ rit20009

Re: [algogeeks] Re: Most compatible people

2012-07-07 Thread Akshat Sapra
tree as per given in the tutorial and find the frequent patterns. -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) *--* sapraaks...@gmail.com akshatsapr...@gmail.com rit20009008@ rit20009...@gmail.comiiita.ac.in -- You received

Re: [algogeeks] Re: Write a C program to reconstruct a BST from a given array of preorder traversal.

2012-07-06 Thread Akshat Sapra
There is no need to use any other data structure or sort the array one can directly construct the BST from a given array by taking one element at a time from the beginning and inserting into a BST. -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus

Re: [algogeeks] adobe

2012-07-01 Thread Akshat Sapra
Using Two Mallocs : int *data; int **arr; data = malloc(sizeof(int) * nrows * ncols ); arr = malloc(sizeof(int*) * nrows); for ( int i = 0; i nrows; i++) { arr[i] = data[ i * ncols ]; } -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus

Re: [algogeeks] trie display

2012-07-01 Thread Akshat Sapra
Apply DFS in the trie -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) *--* sapraaks...@gmail.com akshatsapr...@gmail.com rit20009008@ rit20009...@gmail.comiiita.ac.in -- You received this message because you are subscribed

Re: [algogeeks] Re: Question asked in Amazon Online Test

2012-07-01 Thread Akshat Sapra
== '#' ) { stk.pop(); postfix[j] = stk.top(); j++; stk.pop(); } stk.push('#'); } } -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus

Re: [algogeeks] Find the Max from each sub-array of size k

2012-06-23 Thread Akshat Sapra
To do this question in O(n) time follow the post Segment trees in this post of topcoder http://community.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor Here in this given algorithm preprocessing time in O(n) and query time is O(log n). -- Akshat Sapra Under Graduation

Re: [algogeeks] Microsoft Interview Question

2012-06-20 Thread Akshat Sapra
void make_group( int a[], int size) { int j = 0; for ( int i = 0; i size; i++ ) { if ( a[i] 0 ) { swap(a[i],a[j]); j++; } } } -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus

Re: [algogeeks] [amazon]: dutch national flag algorithm

2012-06-10 Thread Akshat Sapra
int low,mid,high; low = mid = 0; high = (int)(sizeof(arr)/sizeof(arr[0]))-1; /* According to Dutch national flag problem there are three types of quantities in an array and we have to combine these elements together but in

Re: [algogeeks] [amazon]: dutch national flag algorithm

2012-06-10 Thread Akshat Sapra
sorry for the above post , there was careless mistake of mine. The code will be [code] int low,mid,high; low = mid = 0; high = (int)(sizeof(arr)/sizeof(arr[0]))-1; /* According to Dutch national flag problem there are

Re: [algogeeks] Amazon : Find popular cost

2012-06-10 Thread Akshat Sapra
[arr[i]] max_till_now ) max_till_now = hashmap[arr[i]]; } print(max_till_now); -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) *--* sapraaks...@gmail.com akshatsapr...@gmail.com rit20009008@ rit20009...@gmail.comiiita.ac.in -- You

Re: [algogeeks] Find the element in Array

2011-08-31 Thread Akshat Sapra
Solution: arr[n],sum = 0; for ( int i = 0 ; i n; i++ ) { sum ^= arr[i]; } print sum; // required number -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) -- sapraaks...@gmail.com akshatsapr...@gmail.com rit2009...@iiita.ac.in

Re: [algogeeks] Amazon - Interview Qn

2011-08-31 Thread Akshat Sapra
= end-next; } while ( end != start ) } call the functions two times inverse(0th node,n-1th node); inverse(nth node, list.size()th node); -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) -- sapraaks...@gmail.com akshatsapr

Re: [algogeeks] confusion

2011-08-29 Thread Akshat Sapra
: By Pointer to array we means that there is a pointer that is defined to point to some index in an array. Example:- There is some array arr and we define a pointer a; int *a = arr; then this points to value arr[0]; and if int *a = arr+9; then this points to value arr[9]; -- Akshat Sapra Under

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-29 Thread Akshat Sapra
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Akshat Sapra