Re: [algogeeks] Digest for algogeeks@googlegroups.com - 3 updates in 1 topic

2014-12-15 Thread Vikas Rastogi
another one could be some sort of hashing logic modulo n. Get request, create hash , compute modulo n. check assign cache and return. This will make sure of even distribution but with additional cost of hash computation. Regards, Vikash 8121873513 On Sun, Dec 14, 2014 at 5:07 PM,

[algogeeks] Re: Comparing string of unequal length

2014-10-07 Thread vikas
question unclear ?What is to be minimize ? in given example: ca*d*bch abc what is role of d ? On Monday, 6 October 2014 22:52:10 UTC+5:30, Rishav wrote: Hi everyone, I was asked this question recently in an interview: Given two strings of unequal length, you have to pad the smaller

[algogeeks] Re: What is the algorithm for this problem

2014-07-02 Thread vikas
. Then based on the answer, remove any orders from the list which are not consistent with that answer. Repeat the process until you have only one order remaining. Don On Tuesday, July 1, 2014 12:15:14 PM UTC-4, vikas wrote: One of my friend posted this question to me and I am unable to get

[algogeeks] What is the algorithm for this problem

2014-07-01 Thread vikas
One of my friend posted this question to me and I am unable to get anywhere. Could you guys please help A game of cards has 5 colors and 5 values. Thus a total of 25 cards are possible. Player 1 will choose n cards and tell you exactly , what all cards he has. Then he will spread cards in

[algogeeks] Re: Loan

2012-11-13 Thread vikas
you should contact Indian Embassy, they will help you out. On Tuesday, 13 November 2012 15:02:39 UTC+5:30, Virag wrote: Hello, I hope this e-mail reaches well. Just to let you know that I'm presently in Spain for an Agricultural Conference but I'm in a serious fix; I was mugged and lost

[algogeeks] Re: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of T1.

2012-10-28 Thread vikas
values equal 42 except the rightmost node which is 43, these approaches will take a very long time. Any ideas on how to improve performance in such cases? Don On Oct 25, 3:09 am, vikas vikas.rastogi2...@gmail.com wrote: How about this Stacktree* st; CheckSubtree(tree *bigTree

Re: [algogeeks] C output

2012-10-17 Thread Vikas Kumar
) = numberofElementPresentInArray*sizeof(dataType) -- *Thanks,* *Vikas Kumar* * * -- 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] finding element in array with minimum of comparing

2012-10-01 Thread vikas
still there is no improvement, compiler will generate the code to compare with zero here. what you have accomplished is , hide it from human eyes On Monday, 1 October 2012 15:25:09 UTC+5:30, Navin Kumar wrote: @atul: still it won't compare 0 th element. Slight modification in your code:

[algogeeks] Re: microsoft_c++_qstn

2012-10-01 Thread vikas
not sure what interviewer meant here, does not look like compiler dependent code, and BTW, last recurrence yield 5 :) and not 8, one possible def is, you have a function with no return and compiler is independent for choosing what to return in this case, just a guess. Not sure about cpp

[algogeeks] [Google question]

2012-08-01 Thread vikas rai
There is a set of 9 students and 3 schools Every school can be alloted atmax 3 students .Every school and student has its coordinates .Now we have to allot student in such a way that the sum of distance from all the student to the school should be minimum. We have to solve this in less than O(n^3)

Re: [algogeeks] C o/p

2012-07-10 Thread vikas
he is right. On Tue, Jul 10, 2012 at 3:13 PM, rahul sharma rahul23111...@gmail.comwrote: yeahu r ryt On Tue, Jul 10, 2012 at 10:01 AM, Firoz Khursheed firozkhursh...@gmail.com wrote: Well, when i compiled the code the output ie i is alway i=2, http://ideone.com/AFljo

[algogeeks] Help needed for telephonic interview from Amazon banglore.

2012-06-30 Thread Vikas
Hi I have one year experience and have interview scheduled on monday. Pease help me with your experience or knowledge regarding questions, strategy and any misc aspect. Thanks in advance -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] Please help in understanding this question. I have no answers just this question.

2012-06-30 Thread Vikas
Given matrix(screen black n white)..where 1 represents black dot and 0=white. there can b many images/objects in it..return list of coordinates for each obkect..(Hint do BFS) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

[algogeeks] Re: determine if a string if of form pZq

2012-04-20 Thread vikas
couldn't understand the question :( On Apr 19, 1:32 pm, tech coder techcoderonw...@gmail.com wrote: determine whether the given string is of form pZq. p and q can contain only X and Y. like if p=XXYX then z will be XYXX for ex  XXYXXXYXX   is valid the limitation is that you can read only

[algogeeks] Re: GPU doubt

2012-04-09 Thread vikas
Hey Arun, IIya, the GPUs are faster because of 1. designed for graphics processing, which involves a lot of matrix processing capabilities , simple example transformation of matrices in to various view (projection, model and viewport , some times needed even in real time) so these computation

[algogeeks] Re: Vertical Sum in a given Binary Tree

2012-03-19 Thread vikas
verticalSum( node * root, List * sum) { if(root == null) return; sum-data += root-data; verticalSum(root-left, sum-left); verticalSum(root-right, sum-right); } 1 / \ 2 3 / \/ \ 4 5 6 7 a b c d e Vsum(1, c) c= 1 Vsum (2,

[algogeeks] Re: Dynamic programming question

2011-12-13 Thread vikas
Graph take up, right and bottom as nodes connected to current and do find max path. On Dec 13, 3:44 pm, Azhar Hussain azhar...@gmail.com wrote:   We have apples arranged in a mxn matrix. We start from the upper left corner and have to reach bottom right corner with maximum apples. We can only

[algogeeks] Re: smallest segment in a document containing all the given words

2011-12-02 Thread vikas
parse the document for the words and maintain a position table position table should be like this: w1- p1 p2 p3pn w2-x1 x2 x3 xn k lists O(n) if hashing is used now go to begining of list and findout the maximum position say 'start' O(k) similarly from end of all list , check for the

[algogeeks] Re: Any one

2011-11-27 Thread vikas
wrote: @vikas will u please elaborate ur answer. @atul yeah thats true, target will be the words from the dictionary but we dont have a specific target, here it will be brute force if we check newly form word with each  of the word in dictionary. On Sat, Nov 26, 2011 at 9:15 PM, atul

[algogeeks] Re: Any one

2011-11-26 Thread vikas
this is well known problem, use the BFS traversal / Backtracking On Nov 26, 3:54 pm, tech coder techcoderonw...@gmail.com wrote: i think edit distance algorithm can not be used here because in edit distance problem we have a target string and a source string. Here we dont have any target word.

[algogeeks] Re: Maximize Subsquare

2011-11-26 Thread vikas
allOnes(row, column, len) so allone(i, 0, k) will check if A[i][0] to A[i][k] has all the ones similarly another allone should check for all column values. so algo is if you come across any i, j which is '1' , then check for sq ending at i-1, j-1 and all the borders , if all are ones, store the

[algogeeks] Re: OPengl implementation of dijiktras algorithm

2011-11-26 Thread vikas
opengl is graphics spec , what hell it has to do with dijkstra ? On Nov 26, 1:49 pm, naveen ms naveenms...@gmail.com wrote: hi all      Any one has the OPengl implementation of dijiktras algorithm.or any idea how to implement it.. With regards Naveen -- You received this message because

[algogeeks] Re: Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted

2011-11-24 Thread vikas
char arr[] = {'a', 'b', 'e', 'f', 'd', 'g', 'h', 'i'}; calculate the point where array is not sorted , in this case arr[4] = 'd' calulate k in array[5..n] such that k 4 arr[k] d , take the min = min{ arr[k] } same thing for max from reverse use quick /selection sort to identify the correct

[algogeeks] Re: an os question

2011-11-13 Thread vikas
that is normal in embedded systems, what you should do is , put the logs in the particular module, which can be enabled by choice. Another option is to store the stack traces. using such techniques , you will be able to find the problem, at least you will be able to reach near to it. On Nov 13,

[algogeeks] Re: Amazon Question

2011-11-12 Thread vikas
seems like quesion of permutation, it will take all the permutation to check which one can lead to answer, there will be always be more than one solution complexity ((n-1)!) anyone for better solution ?? On Nov 12, 4:27 pm, surender sanke surend...@gmail.com wrote: @myself if number of

[algogeeks] Re: free() function

2011-11-11 Thread vikas
nopes , they are not connected, it is just a chance you are getting the same values and nothing is overwritten there: basically these are DANGLING POINTERS . Now you should keep practising something like this #define FREE(N) { free(N); N=NULL;} to avoid such mistakes On Nov 11, 3:41 pm, shady

[algogeeks] Re: Median of 2D matrix

2011-11-08 Thread vikas
wrote: Can you explain how a heap helps get the answer?  Just to put the elements in a heap requires O ( N^2 log (N) ) time. On Nov 7, 4:12 pm, vikas vikas.rastogi2...@gmail.com wrote: I think the best we can have is nlogn solution with the heap approach. On Nov 6, 10:27 pm, Dave

[algogeeks] Re: Median of 2D matrix

2011-11-07 Thread vikas
I think the best we can have is nlogn solution with the heap approach. On Nov 6, 10:27 pm, Dave dave_and_da...@juno.com wrote: @Mohit: Here is a counterexample: 10      11        52      53      54 20      21      112     113     114 30      31      122     123     124 40      41      132

[algogeeks] Re: Binary tree to BST

2011-11-07 Thread vikas
@ Above no need to have another array or nything binTreeToBST(node *root) { if(!root )return; node *newRoot; binTreeToBSTConv(root, newRoot); } binTreeToBSTConv(node *old, node *new) { if(!old ) return; binTreeToBSTConv(old-left, new);

[algogeeks] Re: Questions

2011-11-07 Thread vikas
, I did not get your idea of reducing complexity , can you describe it in detail ? On Nov 4, 8:41 am, surender sanke surend...@gmail.com wrote: @vikas ur algo will search for 1st element of 1d in whole 2d array, on worst case u'll search it in n^2, then search for all 1d elements in 2d in O(n

[algogeeks] Re: Maximize Subsquare

2011-11-07 Thread vikas
try this: sq(i, j)= k is maximum sqare possible ending at i, j and has length k in the matrix iXj sq(i, j) = k if {sq( i -1, j-1) AllOnes(i,0, k) AllOnes(0, j, k)} = 1 if sq(i, j) == 1 = 0 otherwise On

[algogeeks] Re: coding round question

2011-11-07 Thread vikas
@Vikas, I think the brute force here will be combinatorial , you need to calculate all the combinations of lucky say 4, 7, 47, 74 and then try to find all of the moves combination which maximize this lucky array index, may be from last to first, just for little optimization. A bit tough

[algogeeks] Re: Mystery Of Extra bytes

2011-11-07 Thread vikas
byte stuffing On Nov 2, 2:17 am, SAMMM somnath.nit...@gmail.com wrote: As we all know that the new and delete operator , they are inherited and tell call constructor and destructor respectively . Now Suppose I have One Integer variable for the base class and one more Integer variable for the

[algogeeks] Re: Questions

2011-11-01 Thread vikas
what do you mean by subset of 1D present in the 2D array? is it something like 3245 , the search may be 3245/ 24/ 45/ all 16 subsets need to be searched? On Oct 28, 12:02 pm, SAMMM somnath.nit...@gmail.com wrote: How do u plan to implement it ??? -- You received this message because you

[algogeeks] Re: Questions

2011-11-01 Thread vikas
:- 2d array :: 1  2  3   4    5    6 7   8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 we hav 1d array as :-- 13 2 21 10 23 12 So the 1d array is a subset of 2d array ... On 11/1/11, vikas vikas.rastogi2...@gmail.com wrote: what do you mean by subset of 1D present in the 2D array

[algogeeks] coding round question

2011-10-30 Thread vikas kumar
There are a number of integer ranges say [ L, R]i denoting left and right of segment i, lets says we are given K such segments and we define one operation as move which makes our chosen segment to move either +1 or -1 so after move(i, +1) segment i will be [L+1, R+1]. There are some particular

[algogeeks] Re: coding round question

2011-10-30 Thread vikas kumar
The question was from startup company verego (may be misspelled), you understood it in correct way. We are given 'k' number of ranges in the fashion L, R they are all integers in big ranges , (assume long long for the case) then we are given move operation defined as move( i, +1/-1) : so range

[algogeeks] Re: Bit Magic ....Always Stuck ..

2011-10-16 Thread vikas
for next larger number check for 1st bit set x = n~(n-1) e.g. n = 10100 = 20 n -1 = 10011 x = 10100 01100 = 100 for next larger number check for 1st 0 and set the bit thus y = ~x n = y ~(y-1) x |= n x = 10101 = 21 y = 01010 = 10 y-1 = 01001 = 9 n = 1010

[algogeeks] Re: Algo for Search in a 2D Matrix

2011-10-13 Thread vikas
@Sunny, good catch, k X k approach wont work lets try to use matrix itself as heap heapify(int cr, int cc, int Nr, int Nc){ mr = cr; mc = cc; if(cr+1 Nr) mr = cr+1 mc = cc; if(cc + 1 Nc min A[cc+1][cr]) mr = cr; mc = cc+1; if(A[cr][cc] A[mr][mc]){ swap(A[cr][cc]

[algogeeks] Re: Algo for Search in a 2D Matrix

2011-10-12 Thread vikas
@Shiva, not necessarily in upper half take the transpose of example put by Dave and see by yourself There are few observations for this question: 1. kth smallest will always lie in first k*k matrix 2. it wont be part of sqrt(k)*sqrt(k) matrix Thus rest all need to be searched

[algogeeks] Re: How to Solve This

2011-10-12 Thread vikas
well , I tried to solve it from Maths though half way through only :( N = number required i.e. (10^k -1)/9 given n = 10x + 3 by eq (10x + 3) * m = N= (10^k - 1)/9 implies k = 2log 3 + log m + log(10x + 3) i.e. k 1 + log n This gives the lowerbound on minimum number of 1 to be start with,

[algogeeks] Re: Tree Center Problem

2011-10-07 Thread vikas
use All Pair Shortest Path On Oct 6, 11:11 am, Nitin Nizhawan nitin.nizha...@gmail.com wrote: hi,    given a tree with N nodes find the node such that its average total distance from each other node is smallest       i.e.  if nodes are labeled 0N-1 then          find i such that    [

[algogeeks] Re: MS Question - Median of a BST without using extra space and in O(n)

2011-09-27 Thread vikas
a simple one is rabit-tortoise method, and using stackless traversal, facing a lot of corner cases in coding this, can someone check this as well? On Sep 27, 6:41 pm, anshu mishra anshumishra6...@gmail.com wrote: its not o(n) it is O(max height of tree) :P i have not seen the constraint. --

[algogeeks] Re: Amazon OS question

2011-09-26 Thread vikas
simple graph question, graph is given as list , just check the dependancy On Sep 25, 6:25 pm, siva viknesh sivavikne...@gmail.com wrote: thanks a lot yogesh... On Sep 25, 2:23 pm, Yogesh Yadav medu...@gmail.com wrote: T1-T2-T3-T6 T1-T2-T4-T7 T1-T2-T5-T8 2 Processor: (T1-T2) ..2

[algogeeks] Re: BST in file

2011-09-24 Thread vikas
if this is simple BST then only preorder will suffice On Sep 24, 10:16 pm, wetheart gumnaamsm...@yahoo.com wrote: You can put the array representation of binary tree directly, with some obvious modifications ofcourse :) On Sep 24, 5:38 pm, asdqwe ayushgoel...@gmail.com wrote: you can put

[algogeeks] Re: can any body explain the output and the general method

2011-09-24 Thread vikas
97!! in whatever sequene rule, it can not print 97. probably you want to say 27 :)) On Sep 23, 4:59 pm, Kunal Yadav kunalyada...@gmail.com wrote: +1 dave Its giving 97 in my compiler. On Fri, Sep 23, 2011 at 4:22 PM, vishwa vishwavam...@gmail.com wrote: its 21 . On Fri,

[algogeeks] Re: opengl

2011-09-21 Thread vikas
redbook, free available ebook On Sep 20, 9:28 pm, punnu punnu.gino...@gmail.com wrote: please somebody suggest some good tutorial in animation in opengl using c++.. thanks in advance -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Re: Microsoft Question

2011-09-18 Thread vikas
hmm, nice questions, can we create an efficient DS to query the strings ?? tried using trie but memory prints are very large ( O(n^2) )? :-(( On Sep 18, 12:59 pm, Anup Ghatage ghat...@gmail.com wrote: For the mentioned scenario, it seems to be the only feasible solution. On Sun, Sep 18,

Re: [algogeeks] Re: Interview Questions

2011-09-15 Thread vikas singh
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. -- Thanks and Regards VIKAS

[algogeeks] Re: Question -- plz answer

2011-09-12 Thread vikas
nill xt xt nill so you see here water used after 6t time is 2xt + 2*2xt +3*2xt + 2xt = 14 xt or 7 cups here 4th level too have half cups filled , please correct me if something is wrong in calculations. On Sep 12, 3:01 am, Dave dave_and_da...@juno.com wrote: @Vikas: I think I have it covered

[algogeeks] Re: Questions --

2011-09-11 Thread vikas
regarding detection of mouth: detect the face and then,try finding the mouth pattern, validate that it is mouth indeed for validation check for eyes, nose at some rational distance .. | --- On Sep 11, 1:11 pm, Anup Ghatage ghat...@gmail.com wrote: ^ Thats correct,

[algogeeks] Re: Question -- plz answer

2011-09-11 Thread vikas
@Dave, should not rate of filling be considered here ? if you note , the side cups are filling in half of rate than to rest of cups in row. On Sep 11, 10:01 am, bharatkumar bagana bagana.bharatku...@gmail.com wrote: what is M? On Sat, Sep 10, 2011 at 8:10 PM, Ishan Aggarwal

[algogeeks] Re: Closest ancestor of two nodes

2011-09-03 Thread vikas
DON's solution will work On Sep 3, 11:28 am, Abhishek Yadav algowithabhis...@gmail.com wrote: this solution works if parent pointer is given. 1. Start moving up from both the nodes (if two nodes become equal, fine this is the common ancestor) till you reach the root node and in between count

[algogeeks] Re: C puzzle

2011-09-03 Thread vikas
f(19222) | | f(1922) -11 -2 =-13 | | f(192) = -9 -2 = -11 | | f(19) = f(1) - 9 = -9 | | f(1) = 0 output -9 -11 -13 On Sep 3, 10:29 pm, teja bala pawanjalsa.t...@gmail.com wrote: Find the output of the following code - plzzz xplain the o/p int find(int j) { if(j1) {

[algogeeks] Re: String Problem

2011-09-01 Thread vikas
@ above, a third string is used, s3 which is strlen(s2)+ strlen(s1) and thus in O(n) space I guess qs calls out for O(1) space. besides , if we have O(n) space , this question simply reduces to finding the number of permutation of string s1+s2 I doubt we can do it in O(1) space, any idea guys

[algogeeks] Re: Winshuttle Interview Questions

2011-08-30 Thread vikas
regarding q2: if we have all the points , I guess we need to move through left to right and scan the loop sort this array during scan using Y-distance. now you have the array which will have probable of max diameter from end to end and problem reduce to find out if circle can be

[algogeeks] Must watch Videos for every Indian http://www.daijiworld.com/tvdaijiworld/tvhome.asp?category=livetv_id=1767

2011-08-30 Thread vikas
Must watch Videos for every Indian http://www.daijiworld.com/tvdaijiworld/tvhome.asp?category=livetv_id=1767 -- 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

[algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-29 Thread vikas
oops On Aug 28, 7:09 pm, Decipher ankurseth...@gmail.com wrote: @vikas - As i said earlier think in 3D . The correct answer is (sqrt(3) - 1)R/(sqrt(3) + 1) = r Using 3D coordinate geometry if (R,R,R) and (r,r,r) are the coordinates of center of large and small sphere . Then , make

[algogeeks] Re: How to save a binary search tree space efficiently

2011-08-29 Thread vikas
yep, I realized the mistake. thanks for the clarification. BTW, what approach will be suitable in Bin Tree, extensible to MST . On Aug 29, 11:49 am, prashant thorat prashantnit...@gmail.com wrote: @vikas : you can use recursive approach to draw tree here we go:  6 4 3 5 7  8 11 12 1

[algogeeks] Re: puzzle

2011-08-28 Thread vikas
lol On Aug 27, 1:44 am, icy` vipe...@gmail.com wrote: Other than making little loops and risking the fall on the first trip down, I dont think the rope question has an answer.   NVIDIA just wanted to see if you were suicidal  =D On Aug 26, 3:36 pm, Piyush Grover

[algogeeks] Re: inorder predecessor

2011-08-28 Thread vikas
no corner cases .. :D On Aug 26, 5:43 pm, Vikram Singh singhvikram...@gmail.com wrote: i m writing just a pseudocode... // root is the root of tree    and   node is the node whose predecessor is to be found predecessor(root, node) { parent=NULL; if(root==NULL) return ;

[algogeeks] Re: How to save a binary search tree space efficiently

2011-08-28 Thread vikas
@Dhriti how about this one 6 4 7 3 5 8 1112 your preorder is 6 4 3 5 7 8 11 12 try reconstruction

[algogeeks] Re: How to save a binary search tree space efficiently

2011-08-28 Thread vikas
@ Sagar, level order can be stored but you need to remember the nulls always On Aug 29, 12:06 am, sagar pareek sagarpar...@gmail.com wrote: level order traversal is best for this case :) On Sun, Aug 28, 2011 at 11:53 PM, prashant thorat prashantnit...@gmail.comwrote: only preorder

[algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-26 Thread vikas
think in 2d and I assume that both the sphere are touching each other. it should be simple 2d maths now :) On Aug 25, 8:32 pm, rakesh kumar rockey.rav...@gmail.com wrote: Could you explain the solution for shere problem On Thu, Aug 25, 2011 at 3:49 PM, vikas vikas.rastogi2...@gmail.com

[algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-25 Thread vikas
@ All, 1. build a interval tree using startpoints as the key 2. augment this tree such that each interval contains the number of ppl arrived, in this case 1. 3. use this tree and traverse , use this check, if start/end of tree node is inbetween the interval you are searching, person was

[algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-25 Thread vikas
5th qs r = R(3-2sqrt(2)) On Aug 25, 1:56 pm, vikas vikas.rastogi2...@gmail.com wrote: @ All, 1.   build a interval tree using startpoints as the key 2.   augment this tree such that each interval contains the number of ppl arrived, in this case 1. 3.   use this tree and traverse , use

[algogeeks] Re: MS Question

2011-08-25 Thread vikas
yep, trie needs to be built On Aug 24, 10:49 pm, Ankur Garg ankurga...@gmail.com wrote: It means when u call that func u get the next word in the document Regards Ankur On Wed, Aug 24, 2011 at 6:59 PM, vikas vikas.rastogi2...@gmail.com wrote: what do you mean by a function

Re: [algogeeks] Android development

2011-08-25 Thread vikas singh
http://linuxconfig.org/get-started-with-android-application-development-using-linux-and-android-sdk this link will definitly gonna give you running HELLO ANDROID app on ua machine. ;) -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1

[algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-25 Thread vikas
it is O(n) and complex unnecessary On Aug 24, 3:58 pm, Ankit Minglani ankit.mingl...@gmail.com wrote: How about this : We use a divide and conquer approach and since the array is sorted. We find the middle element and check its value with its immediate left and right element .. it must match

[algogeeks] Re: vertical sum

2011-08-25 Thread vikas
use this verticalSum(node *root, List *l) { if(root == null) return; root-n += l-n; // check for l-left, l-right and if null, allocate and link them verticalSum(root-left, l-left); verticalSum(root-right, l-right); } On Aug 25, 8:20 pm, Anup Ghatage ghat...@gmail.com wrote:

[algogeeks] Re: MS Question

2011-08-24 Thread vikas
what do you mean by a function for finding the next word is given ? On Aug 22, 1:56 am, Ankur Garg ankurga...@gmail.com wrote: Question--      Given a document containing some words ...and a function for finding the next word is given .design a code which efficiently   search the word  

Re: [algogeeks] C code scanf problem

2011-08-24 Thread vikas singh
at http://groups.google.com/group/algogeeks?hl=en. -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1...@gmail.com http://smrit.wordpress.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] C Trick

2011-08-24 Thread vikas singh
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. -- Thanks and Regards VIKAS

[algogeeks] Need info Regarding CA Technologies

2011-08-24 Thread vikas singh
I need to know, What's the Recruitment Procedure in college of CA Technologies.. Any Link, any info.. Plz Provide it ASAP.. Thanks in Advance :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] C Trick

2011-08-24 Thread vikas singh
On Wed, Aug 24, 2011 at 8:25 PM, praneethn praneeth...@gmail.com wrote: *max=(ab)*a+(ba)*b;* Not allowed ;) Read the constraints applied. -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1...@gmail.com http://smrit.wordpress.com -- You

[algogeeks] Re: Search an array of unknown length

2011-08-23 Thread vikas
nopes, you need to know where the hell it ends even if this is a string , it ends with convention of ending 0. in case it is stream , we know the data length. in case of array, above mentioned approach should work. sizeof(arr)/sizeof(arr[0]) if you are given only a pointer and no length, you

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

2011-08-22 Thread vikas
It seems Dipankar Algo is appropriate at this point of time. each time successor and predecessor check needs to be done at each node and the value need to be updated, This is O(log n) approach because once we check, we move into particular direction. On Aug 21, 4:59 pm, rahul aravind

[algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-22 Thread vikas
using interval tree/segment tree will solve this in straightforward fashion On Aug 22, 12:41 pm, Jagannath Prasad Das jpdasi...@gmail.com wrote: for the stick prob is the stick length required? On Mon, Aug 22, 2011 at 12:48 PM, Jagannath Prasad Das jpdasi...@gmail.comwrote: i think

[algogeeks] Re: Amazon Ques

2011-08-22 Thread vikas
why to bother this much...? just count the elements when popping and output the middle one . while(!s.empty()){ e= s.pop() count++ q.enq(e); } count = 2; while(count){ e = q.deq(); s.push(e); count --; } output s.top() while(!q.empty()){ e = q.deq(); s.push(e); } On Aug 22, 4:27 pm, Shravan

Re: [algogeeks] Syllogism

2011-08-20 Thread vikas singh
this group at http://groups.google.com/group/algogeeks?hl=en. -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1...@gmail.com http://smrit.wordpress.com -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks]

2011-08-15 Thread vikas singh
VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1...@gmail.com http://smrit.wordpress.com -- 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

Re: [algogeeks] SISO

2011-08-15 Thread vikas singh
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. -- Thanks and Regards VIKAS SINGH

[algogeeks] Write a program to find the empirical formulae from physical formulae

2011-08-10 Thread vikas
Write a program to find the empirical formulae from physical formulae ex: ch3((oh)2(nh3)2)5 has empirical formulae c1 h43 o2 n10 -- 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.

Re: [algogeeks] Re: sizeof structure

2011-08-06 Thread vikas singh
expect the PADDING would be.. try it..! -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1...@gmail.com http://smrit.wordpress.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Re: sizeof structure

2011-08-06 Thread vikas singh
bytes short u :3; ans=2 bytes -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1...@gmail.com http://smrit.wordpress.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Re: sizeof structure

2011-08-06 Thread vikas singh
struct demo { char c; double d; int s; }; what wud be the size of struct demo object? if you get the concept, then try this one... just one student asked this in other thread :) :) -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1

Re: [algogeeks] Re: sizeof structure

2011-08-06 Thread vikas singh
continuous execution of your code struct node { char c; double d; int s; }; int main(){ struct node a; struct node *p; p=a; printf(size = %d \t address=%u, sizeof(a), p); } I don't know why you said 24 in the thread.. is it compiler dependent ?? -- Thanks and Regards VIKAS

Re: [algogeeks] Re: sizeof structure

2011-08-06 Thread vikas singh
on dev c++.. i m getting correct out put as 24. when i hav executed ur code on turbo version it shows 11 ,i.e it is doing no padding at all.. On Sat, Aug 6, 2011 at 7:21 PM, vikas singh shyguy1...@gmail.com wrote: @sandeep size = 16 address=3220095484 size = 16 address=3220598412 size

[algogeeks] Nagarro is on a recruiting SPREE.......!

2011-08-02 Thread vikas
Hi, To keep pace with the expanding opportunities, we are constantly looking for “the brightest minds” to join Nagarro at various levels(in Gurgaon(india) branch). There are various post for experienced and fresher level guys(asp.net, WPF,Windows,JAVA,FLEX,SHAREPOINT 2010 and SHAREPOINT 2007).

[algogeeks] Nagarro is on a recruiting SPREE.......!

2011-08-02 Thread vikas
Hi, To keep pace with the expanding opportunities, we are constantly looking for “the brightest minds” to join Nagarro at various levels(in Gurgaon(india) branch). There are various post for experienced and fresher level guys(asp.net, WPF,Windows,JAVA,FLEX,SHAREPOINT 2010 and SHAREPOINT 2007).

[algogeeks] Re: Largest BST subtree in Binary Tree

2011-07-13 Thread vikas
correction : ans should be :)                                                        10                                                           \                                                           15                                                         /  \                  

[algogeeks] questions related to C

2011-07-08 Thread vikas
Q1 - write a generic macro to swap two values (int,float,double,pointers as well ) Q2 - Implement your own malloc() and free() function Q3 - Two unsigned ints given a, b you have add these numbers and return the sum ...Make sure in case of overflow return error. -- You received this

Re: [algogeeks] questions related to C

2011-07-08 Thread vikas
Thanks very much for recommending. By the way, Solutions to any problem posted by anybody, will be available in some or other book. I also knows KR is a good book. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread vikas
very nice link for questions of type Q9. http://pw1.netcom.com/~tjensen/ptr/ch9x.htm -- 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/-/0ngOncUXrRYJ. To post

[algogeeks] Some adobe interview questions.

2011-07-05 Thread vikas
These all were asked cumulatively in five interviews, one after another. Q1 given 2 string A ,B. write a code to find all character of A exists in B or not? Q2. A puzzle at http://mathforum.org/library/drmath/view/56756.html Q3. Find a 8-digit number, where the first figure defines the count

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread vikas
My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start];

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread vikas
Sum of all the digits should be 8 But it was not said by the interviewer i think we must print all possible combinations for the question -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

[algogeeks] Amazon Telephonic Interview Questions

2011-06-30 Thread vikas
1. write iterative program to find if a binary tree is binary search tree or not. 2. write iterative program to convert a binary tree into its mirror image. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web

[algogeeks] Re: Amazon Telephonic Interview Questions

2011-06-30 Thread vikas
for 1 i did implement exactly the same algorithms. and for 2 i donot know why but at that time i was not able to implement it iteratively and hense implemented its recursive version only. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Amazon telephonic question

2011-06-29 Thread vikas
for 2nd part of 1st question, when array has become sorted for ex: 3 5 10 16 17 35 40 56 67 and num is 33 becomes : 3 5 10 16 16 .. make array of 17 elements s[0,0,1,2..] s[16] = 2 means we find a duplicate hense resultu int m = (num%2==1)?(num/2+1):(num/2) for (int

  1   2   >