[algogeeks] Suggest a solution using BFS

2011-01-18 Thread ankit sablok
i have been trying this problem first i brute forced it and i was right using brute force but can someone suggest a BFS solution to the problem http://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8category=6page=show_problemproblem=347 suggest something better than brute force --

[algogeeks] Suggest a solution using BFS

2011-01-18 Thread ankit sablok
please suggest a solution for this problem using BFS i m nt able to get how we apply bfs here though brute force would do http://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8category=6 thnxx in advance please explain in detail so that i become able to tackle such problems in

[algogeeks] Re: Suggest a solution using BFS

2011-01-18 Thread juver++
Since there are no more than 83681 unique words (and there are only 5letters words), the simplest approach is using recursive function for words generation (similar to DFS). At each step add new letter which is greater than the last added (last letter in the word). Also it can be done using BFS

[algogeeks] Count number of digits

2011-01-18 Thread rgap
How can i count the number of digits 0s,1s,2s,3s,... 9s in a number n for example if n=33902 number of 0s=1 number of 3s=2 number of 9s=1 number of 2s=1 -- 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] Count number of digits

2011-01-18 Thread Sarma Tangirala
Mod 10 and divide by 10 to get each digit and then hash that digit to an array and add one to the array entry. Array from 0 to 9 and initialize to each array value 0. Sent from my BlackBerry -Original Message- From: rgap rgap...@gmail.com Sender: algogeeks@googlegroups.com Date: Tue,

Re: [algogeeks] Count number of digits

2011-01-18 Thread Sarma Tangirala
If the number is larger that 64 bits then treat it as a string but do the same thing apart from mod 10 divide bt 10. Sent from my BlackBerry -Original Message- From: rgap rgap...@gmail.com Sender: algogeeks@googlegroups.com Date: Tue, 18 Jan 2011 03:31:12 To: Algorithm

[algogeeks] Re: Count number of digits

2011-01-18 Thread rgap
This code prints the number of digits 0,1,2,... 9sbetween A and B How does it works? #include iostream using namespace std; int pot10(int i) { int n = 1; while (i--) n *= 10; return n; } int digits(int n, int d) { if (n 10 n d - 1) return d ? 1 : 0; int s = 0, r = 0,

[algogeeks] Re: Hellof Friends. Regarding Microsoft Internship test

2011-01-18 Thread Rahul Menon
Thanks for the replies @Sunny Last year when they came to our college, they also asked questions relating to Operating Systems and Database. Did you forgot to mention it or is MS avoiding such questions now? Regards Rahul -- You received this message because you are subscribed to the

[algogeeks] Re: Google

2011-01-18 Thread Harshal
there will be 1 or 2 rounds of telephonic interviews. How and what to prepare for that? -- 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

[algogeeks] Google

2011-01-18 Thread Harshal
hi guys, Google is coming in my college for internship. Apart from general algorithmic questions, can someone please tell me are there any specific areas from where google mostly asks questions. I will appreciate any advice regarding how to prepare for Google. -- Harshal -- You received this

[algogeeks] Re: Count number of digits

2011-01-18 Thread juver++
digits(n, d) - returns how many times digit d is in the numbers [0, n]. -- 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

Re: [algogeeks] Re: Hellof Friends. Regarding Microsoft Internship test

2011-01-18 Thread sunny agrawal
from last 2 years they haven't asked questions on OS in written. it depends if written contains objective type questions also, OS may also be there -- 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] Re: Hellof Friends. Regarding Microsoft Internship test

2011-01-18 Thread sunny agrawal
from last 2 years i mean from last 2 years @IIT Roorkee On Tue, Jan 18, 2011 at 6:12 PM, sunny agrawal sunny816.i...@gmail.comwrote: from last 2 years they haven't asked questions on OS in written. it depends if written contains objective type questions also, OS may also be there --

Re: [algogeeks] Re: Google

2011-01-18 Thread shubham singh
wch college u are in ? -- 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...@googlegroups.com. For more options,

[algogeeks] C++ MCQs

2011-01-18 Thread Decipher
Q1) How to declare a multidimensional array using new operator ?? Q2) What's the use of virtual friend function ? Give egs. Q3) What's the order of construction of objects for a class Derived which - contains an object of class Data1 , inherits a class Base1 and then inherits virtual base class

Re: [algogeeks] Re: Google

2011-01-18 Thread Harshal
nitk On Tue, Jan 18, 2011 at 6:36 PM, shubham singh shubhamsisodia0...@gmail.com wrote: wch college u are in ? -- 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

[algogeeks] partition array

2011-01-18 Thread Prims
. There is an array, how will you partition that into two parts so that the sum of both the sub set is minimum -- 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

Re: [algogeeks] Re: amazon c questn

2011-01-18 Thread Algoose chase
@avpostnikov In my reply I meant TCHAR ( maybe it doesnt apply to the example given in the problem) when your project is being compiled as Unicode, the TCHAR would translate to wchar_t. If it is being compiled as ANSI/MBCS, it would translated to char Not always we explicitly use wchar_t. On

[algogeeks] L values and r values

2011-01-18 Thread rahul rai
Do l values and r values hold any practical significance how do we find l and r values of things like \\*((A))\\ if A is an integer if A is an array of integers If A in itself is a reference -- Rahul K Rai rahulpossi...@gmail.com -- You received this message because you are

Re: [algogeeks] Re: google mcqs

2011-01-18 Thread Algoose chase
Pipeline : Choice B : 165 ( this pipeline wastes 20 ns between last 2 stages for each item ) Scheduling : Choice B Ram : Choice B Synchronization : Choice B On Mon, Jan 17, 2011 at 10:01 AM, Bhavesh agrawal agr.bhav...@gmail.comwrote: On Mon, Jan 17, 2011 at 10:00 AM, Bhavesh agrawal

Re: [algogeeks] Re: Bit Manipulation

2011-01-18 Thread Terence
No. It can be applied to any positive number N. The solution above splits the numbers by the least significant bit, choose the group with missing number, and then drop the last bit and continue. In this way the set [0,N] is partitioned (almost) evenly into 2 groups: {2k | k=0,1,...,N/2} and

[algogeeks] bfs doubt

2011-01-18 Thread rahul rai
Let G = (V, E) be a **, cONNECTED undirected graph. Give an O(V + E)-time algorithm to compute a path in G that traverses each edge in E exactly once in each direction. Describe how you can find your way out of a maze if you are given a large supply of pennies. from clrs -- You received this

[algogeeks] Sites for Interview Questions

2011-01-18 Thread Yellow Sapphire
Hi, Can someone suggest good books/websites/blogs for interview related questions. thanks-- YS -- 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,

Re: [algogeeks] bfs doubt

2011-01-18 Thread ankit sablok
one possible solution can be that while storing the graph using adjacency lists u can associate a color variable with each edge so that u color the edge as u traverse it like if u want to check wether edge (u,v) has been traversed while traversing u's adjacecny list check wether (u,v) has been

Re: [algogeeks] Re: Google

2011-01-18 Thread shubham singh
thats cool i am from uptu google didnt visit here so no idea :D :D -- 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] Re: bfs doubt

2011-01-18 Thread juver++
Path you mentioned to find is an Euler-path. It can be traversed during DFS. Here http://en.wikipedia.org/wiki/Eulerian_path is an algorithm. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Re: bfs doubt

2011-01-18 Thread juver++
However, Eulerian path traverses each edge (in one direction) exactly once. You may repeat the path in backward order. So you traverses edges in each directions once. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] Re: partition array

2011-01-18 Thread juver++
Did you mean absolute difference between two subsets is minimal? -- 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] Re: bfs doubt

2011-01-18 Thread juver++
I found that Euler's algo cannot be applied here. Please ignore my above posts. -- 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] Re: bfs doubt

2011-01-18 Thread juver++
But if we represent undirected edge (A, B) as (A-B) and (B-A) then after this problem can be reduced to searching Eulerian path -- 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] Sites for Interview Questions

2011-01-18 Thread rajeev kumar
try http://www.careercup.com/ http://www.careercup.com/Thanks, rajiv. On Tue, Jan 18, 2011 at 7:57 AM, Yellow Sapphire pukhraj7...@gmail.comwrote: Hi, Can someone suggest good books/websites/blogs for interview related questions. thanks-- YS -- You received this message because you

[algogeeks] Re: Sites for Interview Questions

2011-01-18 Thread awesomeandroid
http://code-forum.blogspot.com On Jan 19, 7:10 am, rajeev kumar rajeevprasa...@gmail.com wrote: tryhttp://www.careercup.com/ http://www.careercup.com/Thanks, rajiv. On Tue, Jan 18, 2011 at 7:57 AM, Yellow Sapphire pukhraj7...@gmail.comwrote: Hi, Can someone suggest good

[algogeeks] Call for Papers: The 2011 International Conference on Computer Graphics and Virtual Reality (CGVR'11), USA, July 18-21, 2011

2011-01-18 Thread A. M. G. Solo
   CALL  FOR  PAPERS       CGVR'11 The 2011 International Conference on Computer Graphics   and Virtual Reality       Date and Location: July 18-21, 2011, USA       http://www.world-academy-of-science.org/    

Re: [algogeeks] Re: partition array

2011-01-18 Thread Aditya
this could be solved by using dynamic programing (knapsack problem) On 1/19/2011 12:30 AM, juver++ wrote: Did you mean absolute difference between two subsets is minimal? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Re: google mcqs

2011-01-18 Thread Pratik Kathalkar
For RAM question I guess it's answer : A see -: http://www.computermemoryupgrade.net/memory-influence-on-performance.html On Mon, Jan 17, 2011 at 12:59 PM, Algoose chase harishp...@gmail.comwrote: Pipeline : Choice B : 165 ( this pipeline wastes 20 ns between last 2 stages for each item )

[algogeeks] Operating System

2011-01-18 Thread Decipher
Does anyone has solution to Operating System by Galvin or by William Stallings ?? -- 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