@jaspreet : i dont find much difference between using BFS or
backtracking...which is doing similar to DFS.
On Tue, Oct 16, 2012 at 4:28 AM, Jaspreet Singh
wrote:
> BFS
>
>
> On Sun, Oct 14, 2012 at 4:21 PM, Rahul Kumar Patle <
> patlerahulku...@gmail.com> wrote:
>
>> response awaited!!!
>> an
its not the best i think and also not a dp solution but can be done by this.
On Tue, Oct 16, 2012 at 4:28 AM, Jaspreet Singh
wrote:
> BFS
>
>
> On Sun, Oct 14, 2012 at 4:21 PM, Rahul Kumar Patle <
> patlerahulku...@gmail.com> wrote:
>
>> response awaited!!!
>> anyone??
>>
>> On Sat, Oct 13, 2012
BFS
On Sun, Oct 14, 2012 at 4:21 PM, Rahul Kumar Patle <
patlerahulku...@gmail.com> wrote:
> response awaited!!!
> anyone??
>
> On Sat, Oct 13, 2012 at 12:31 AM, Rahul Kumar Patle <
> patlerahulku...@gmail.com> wrote:
>
>> Pls help to solve this que.. does any one have DP solution for following
>
@All *Here is the working code: test on input {-1,5,3,-8,4,-6,9} and
{1,-1,2}*
Algo:
increment current till first +ve number(p) and decerement end till last
-ve number(n)
now consider only array between [p..n]
If current is negetive, increment current
If current is positive, swap it with end and
@wgp the ques is to maintain the order intact..
--
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...@googlegr
i mean o(n) in single traversal .
On Fri, Jun 22, 2012 at 12:53 AM, sanjay pandey
wrote:
> single traversal n O(n) are 2 diff things...plz specify???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email t
Well they are the same you're going over an array once. As long as they are
not nested they are still counted as O(n) because leading constants are
dropped, at least that's what my acumen says. Need inputs on this guys!
On Friday, June 22, 2012 12:53:02 AM UTC+5:30, suzi wrote:
>
> single traver
single traversal n O(n) are 2 diff things...plz specify???
--
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...@g
can this be done in single pass in O(n) .
On Thu, Jun 21, 2012 at 8:10 PM, rusty wrote:
> guys this is my solution to the problem, it's a bit sloppy but as far as I
> checked it was working please have a go at it?
>
>
> #include
> #include
>
> int main() {
> int arr1[] = {0,-5,3,0,4,-6
@Partha
try with:
A = {2, 2, 9}
B= {1, 6, 6}
On Mon, May 21, 2012 at 7:08 PM, partha sarathi Mohanty <
partha.mohanty2...@gmail.com> wrote:
> a[] = [-1,-3,4,0,7,0,36,2,-3]
> b[] = [0,0,6,2,-1,9,28,1,6]
> b1[] = [0,7,0,36,4,-6,3,0,0]
> b2[] =[-1,-3,11,0,0,0,35,0,0]
>
> suma = 42 proda = -
a[] = [-1,-3,4,0,7,0,36,2,-3]
b[] = [0,0,6,2,-1,9,28,1,6]
b1[] = [0,7,0,36,4,-6,3,0,0]
b2[] =[-1,-3,11,0,0,0,35,0,0]
suma = 42 proda = -84*72*3
sumb = 51 prodb = -84*72*3
sumb1 = 44 prodb1 = -84*72*3
sumb2 = 42 prodb2 = 33*35
do the sum and prod operation w/o 0s and compare the values..
@ashish.. it wont be constant space then.. surely it will be o(n) though
On Mon, May 21, 2012 at 7:23 PM, Ashish Goel wrote:
> Dave,
>
> Cant we have a hash table with the item as key and its count as value
> (walk over array A and build HT).
> For permutation check, walk over second array and s
constant space vs no additional space and then O(n) time complexity not
possible..
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Mon, May 21, 2012 at 8:01 PM, Dave wrote:
> @Ashish: Using a hash table violates the O(1) space requirement given
@Ashish: Using a hash table violates the O(1) space requirement given in
the original problem.
Dave
On Monday, May 21, 2012 8:53:44 AM UTC-5, ashgoel wrote:
> Dave,
>
> Cant we have a hash table with the item as key and its count as value
> (walk over array A and build HT).
> For permutation
Dave,
Cant we have a hash table with the item as key and its count as value (walk
over array A and build HT).
For permutation check, walk over second array and start reducing the count
and remove when count becomes zero for that particular key. If some char
not there in HT, return false, else retu
@Piyush: Did you even try this on any examples? If not, try a = {0,1,2,3}
and b = {0,2,2,2}.
Dave
On Sunday, May 20, 2012 1:39:25 AM UTC-5, Kalyan wrote:
> Piyush. I think we can use your logic. But You should check the product
> also.
> Have 4 variables, sum_a,sum_b , prod_a, prod_b
>
> Ca
@Piyush: Try this i/p 8,0,0 ; 2,6,0-- Ur algo aint adequate..
On Sat, May 19, 2012 at 11:24 PM, Piyush Khandelwal <
piyushkhandelwal...@gmail.com> wrote:
> Hiii!! I have some idea about the solution. Please notify me if i am
> wrong
>
> a= [ 4,3,5 ] and b= [ 3,5,4 ]
> diff=0;
> for (i=0; i
Piyush. I think we can use your logic. But You should check the product also.
Have 4 variables, sum_a,sum_b , prod_a, prod_b
Calculate Sum and product of array 'a' and store it in sum_a,prod_a
Calculate Sum and product of array 'b' and store it in sum_b,prod_b
if sum_a=sum_b && prod_a==prod_b the
@piyush :
your solution will fail for the case
a={5,1,1}
b={3,3,1}
On Sun, May 20, 2012 at 11:54 AM, Piyush Khandelwal <
piyushkhandelwal...@gmail.com> wrote:
> Hiii!! I have some idea about the solution. Please notify me if i am
> wrong
>
> a= [ 4,3,5 ] and b= [ 3,5,4 ]
> diff=0;
> for (i=0;
U are checking if the sum is same or not.. which can be same even if the
elements are different.
On Sun, May 20, 2012 at 11:54 AM, Piyush Khandelwal <
piyushkhandelwal...@gmail.com> wrote:
> Hiii!! I have some idea about the solution. Please notify me if i am
> wrong
>
> a= [ 4,3,5 ] and b= [
Hiii!! I have some idea about the solution. Please notify me if i am
wrong
a= [ 4,3,5 ] and b= [ 3,5,4 ]
diff=0;
for (i=0; i wrote:
> @Harshit: These are a few unanswered questions that came to mind when I
> read your solution attempt: What do you do with negative elements? What is
> the -12t
Well, the interviewer gave a hint to use hash-table.
The key of hash-table will be memory address of original node and value
will be the memory address of the new node.
On Wed, Mar 14, 2012 at 9:43 PM, atul anand wrote:
> @umer : did interviewer told any one of the solution provided in
> the g
@umer : did interviewer told any one of the solution provided in the given
link below or different?
http://www.geeksforgeeks.org/archives/1155
On Tue, Mar 13, 2012 at 11:31 AM, Umer Farooq wrote:
> Yes that is exactly what they wanted. I proposed BFS for this solution.
> Anyway, there was ano
http://www.geeksforgeeks.org/archives/1155
On Tue, Mar 13, 2012 at 11:31 AM, Umer Farooq wrote:
> Yes that is exactly what they wanted. I proposed BFS for this solution.
> Anyway, there was another problem that I was able to solve; but the
> interviewer brought up a much more efficient approach.
Yes that is exactly what they wanted. I proposed BFS for this solution.
Anyway, there was another problem that I was able to solve; but the
interviewer brought up a much more efficient approach.
The problem was:
- Given a linked a linked list with one pointer pointing to next,
another poin
Yes that is exactly what they wanted. I proposed BFS for this solution.
Anyway, there was another problem that I was able to solve; but the
interviewer brought up a much more efficient approach.
The problem was:
Given a linked l
On Mon, Mar 12, 2012 at 11:31 PM, Gene wrote:
> Since there is no
I would assume that in addition to functional testing through
automation(combination of various fonts,sizes etc) the tenets like
reliability, accessibility, interoperability, security(fuzz testing),
different architectures(amd, intel 32 bit, 64 bit etc), stress(extremely
long file reaching space co
use suffix tree it's much faster than simple trie
with ukkonen's method you can build it in O(size of document) and then
searching in it is practically O(1)
http://en.wikipedia.org/wiki/Suffix_tree
http://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf
On Fri, Dec 10, 2010 at 7:54 PM, ADITYA KUM
@ligerdave
agree with u :)
>
--
Regards
Aditya Kumar
B-tech 3rd year
Computer Science & Engg.
MNNIT, Allahabad.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscri
2010/12/7 ritesh :
> q = (len >> 1) << 1;
> what this line is accomplishing?
q = len & 0xFFFE;
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this gro
@Mohit:
I dont think it really matters here.We just have to validate the snapshot of
the game board.Number of players should not have any relevance here.
On Sat, Sep 25, 2010 at 2:46 PM, mohit ranjan wrote:
> @Ashita,
>
> Your logic is fine for one vs one game, but as per question it's "one vs
>
@Ashita,
Your logic is fine for one vs one game, but as per question it's "one vs
many game"
Any idea what is that ?
Mohit
On Sat, Sep 25, 2010 at 1:18 PM, ashita dadlani wrote:
> 1.The soldiers are initially placed at row 2 or row 7th(each-one of white
> and either of black).Also let white o
1.The soldiers are initially placed at row 2 or row 7th(each-one of white
and either of black).Also let white ones be at row 2.So they can never be at
row 1st.Incase it is so in the game,its not a valid game.
2.There are Bishops.Each color has one of its Bishop which moves diagonally
on all white s
its an infinite loop. Beware.
On Mon, Aug 23, 2010 at 5:32 AM, Gene wrote:
> This doesn't work on "abb" for example.
>
> On Aug 22, 9:28 am, Ashish Goel wrote:
> > use a array
> > arr[char]=count char represent say a-z
> > count is # of occurances
> >
> > while (*s!='\0')
> > {
> > arr[*s-'a']+
optimization, use bitmap instead of array...
char can be unicode, char may take 1 or 2 bytes, that can be written, big
deal..
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Sun, Aug 22, 2010 at 7:59 PM, Saikat Debnath wrote:
> This is the answe
Maybe to reduce the memory usage and to include all types of characters we
could create a one to one mapping between the character and the number
of occurrences.And while retrieving start from reverse checking the mapping
value,print if it's one.
On Sun, Aug 22, 2010 at 7:59 PM, Saikat Debnath wro
36 matches
Mail list logo