Re: [algogeeks] Benefits of using Private or Protected Virtual Functions ?

2011-08-23 Thread sarvesh saran
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.4 Also read these two links..they are very informative and a must read for people understanding virtualism. http://www.gotw.ca/publications/mill18.htm http://drdobbs.com/cpp/184403760 -sarvesh On Tue, Aug 23, 2011 at 4:11

[algogeeks] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
Hi, I have a vectorint A or an array (for C guys) that contains the octal representation of a number. So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc i.e no number in the array can be = 8. Now given this array, I need to convert it its decimal representation. The naive way

Re: [algogeeks] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
++){ num=num||(A[i]3*i); } printf(%d,num); I think this will do. On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran aquarian.thun...@gmail.com wrote: Hi, I have a vectorint A or an array (for C guys) that contains the octal representation of a number. So the array can be something like

Re: [algogeeks] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
cegprak...@gmail.com wrote: A[i]3*i why is it needed to convert from base 8 to base 10?? On Sun, Aug 21, 2011 at 4:07 PM, Sanjay Rajpal srn...@gmail.com wrote: Hi your intention was logical OR or BITWISE OR ? u did Logical. Sanju :) On Sun, Aug 21, 2011 at 3:30 AM, sarvesh saran

[algogeeks] triangle numbers in an array

2011-08-21 Thread sarvesh saran
No idea how to solve the problem except the brute force O(n3) approach.I am looking for a better solution than this. Because of O(1) complexity you cannot copy and sort the input. A zero-indexed array A consisting of N integers is given. A triplet (P, Q, R) is triangular if and A[P] + A[Q]

Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread sarvesh saran
, sarvesh saran aquarian.thun...@gmail.com wrote: No idea how to solve the problem except the brute force O(n3) approach.I am looking for a better solution than this. Because of O(1) complexity you cannot copy and sort the input. A zero-indexed array A consisting of N integers is given

Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread sarvesh saran
of the i/p array. Use Quick sort, sorting is done in-place which O(n log n) in time, and O(1) in space. Sanju :) On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran aquarian.thun...@gmail.com wrote: Hi Sanjay, *Because of O(1) complexity you cannot copy and sort the input array. *thanks

Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread sarvesh saran
Hi Sanjay I think i forgot to mention that in my original post..so sorry about that. It is a constant array and should not be modified. thanks, Sarvesh On Sun, Aug 21, 2011 at 8:08 PM, sarvesh saran aquarian.thun...@gmail.comwrote: Hi Sanjay, The input is a constant vector. So it cannot

Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread sarvesh saran
Hi, I have posted this in stackoverflow. So you may choose to join here as well (this question was asked in an adobe written test) http://stackoverflow.com/questions/7138874/find-triangular-triplet-in-an-array thanks, Sarvesh On Sun, Aug 21, 2011 at 8:09 PM, sarvesh saran aquarian.thun

Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread sarvesh saran
two elements in sorted array is third element, if it is true, then all the conditions will hold, otherwise proceed with 2nd,3rd and 4th element. keep doing till u find a triplet, there u break out of the loop. Sanju :) On Sun, Aug 21, 2011 at 8:24 AM, sarvesh saran aquarian.thun

Re: [algogeeks] Re: convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
[A[i]]; Dave On Aug 21, 5:55 am, sarvesh saran aquarian.thun...@gmail.com wrote: Hi Prakash, I'll paste the exact description of the problem: A non-empty array A of N elements contains octal representation of a non-negative integer K, i.e. each element of A belongs to the interval [0

Re: [algogeeks] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
, Anantha Krishnan On Sun, Aug 21, 2011 at 4:25 PM, sarvesh saran aquarian.thun...@gmail.com wrote: Hi Prakash, I'll paste the exact description of the problem: A non-empty array A of N elements contains octal representation of a non-negative integer K, i.e. each element of A belongs

Re: [algogeeks] how to inplace merge to sorted array

2011-08-21 Thread sarvesh saran
http://chriscant.phdcc.com/2008/12/merge-two-sorted-integer-arrays.html http://stackoverflow.com/questions/2126219/how-to-merge-two-sorted-integer-array-in-place-using-on-time-and-o1-space-cos -sarvesh On Mon, Aug 22, 2011 at 12:52 AM, Maximilian Anthony maximilian@gmail.com wrote: how

Re: [algogeeks] help on this

2011-08-21 Thread sarvesh saran
Yogesh. Web OS is dead. Leave it and Move on... Compiler construction is a cool thing to learn though. For final year project, first find a good organization where you can do a project. use your contacts. then find out what kind of projects are available in that organization/IT company.

Re: [algogeeks] how to find a Dynamic programming solution to this problem ?

2011-08-21 Thread sarvesh saran
mistakes in this , you are welcome.. On Mon, Aug 22, 2011 at 1:00 AM, sarvesh saran aquarian.thun...@gmail.com wrote: HI, I have a classic chessboard and rice problem. the detailed statement is in the link:http://pastebin.com/nykkFP84 my solution is : 1. int max_rice(std::vectorstd

Re: [algogeeks] how to find a Dynamic programming solution to this problem ?

2011-08-21 Thread sarvesh saran
to knap sack problem... i am filling each value of matrix by finding the max (a[i-1][j],a[i][j-1])+a[i][j] .. so that the max value will be stored in the each index positions and so in the a[M][N].. On Mon, Aug 22, 2011 at 1:34 AM, sarvesh saran aquarian.thun...@gmail.com wrote: Hi

Re: [algogeeks] test your c++ skills

2011-08-19 Thread sarvesh saran
just Google effective C++ pdf or ebook. You'll get the links. -max On Fri, Aug 19, 2011 at 5:53 PM, sukran dhawan sukrandha...@gmail.comwrote: ok thanks.can u send the link ? On Fri, Aug 19, 2011 at 5:16 PM, sarvesh saran aquarian.thun...@gmail.com wrote: Hi Sukran Dhawan, Stay away

Re: [algogeeks] test your c++ skills

2011-08-19 Thread sarvesh saran
http://siber.cankaya.edu.tr/ozdogan/AdvancedProgramming/fall2004/tutorial/Addison%20Wesley%20-%20More%20Effective%20C++.pdf http://www.4shared.com/document/H9zbLNZW/EffectiveC.html On Fri, Aug 19, 2011 at 6:09 PM, priya ramesh love.for.programm...@gmail.com wrote: not available online :( :(