reset password
Author Message
vsluong4
Posts: 87
Posted 01:39 Oct 08, 2014 |

I've been working on the assignment at https://class.coursera.org/algo-006/quiz?quiz_type=homework and I thought I would post some of the running times I've been getting for it.

 

JAVA:

Using brute force(i.e. looping through twice and checking every entry against the other and keeping a counter) takes 121485720 microseconds(about 2 minutes)

Using a merge counter(like in the video) takes 115250 microseconds(about 1/10th of a second)

C++:

Using brute force(i.e. looping through twice and checking every entry against the other and keeping a counter) takes 27026900 microseconds(about half a minute)

Using a merge counter(like in the video) takes 23949 microseconds(about 1/40th of a second)

 

 

Even though the code is nearly identical(C++ and Java have the same basic syntax) C++ seems to execute the code a lot faster.

Last edited by vsluong4 at 10:48 Dec 09, 2014.
mnava18
Posts: 86
Posted 01:54 Oct 08, 2014 |

wait , are we suppose to be doin those coursera exercises and turning them in? or are those just to try

Last edited by mnava18 at 03:44 Oct 08, 2014.
rabbott
Posts: 1649
Posted 08:32 Oct 08, 2014 |

Good work, VSLuong4! The more relevant comparison is between the two algorithms in the same language: a ratio of more than 1200 to 1 faster.

This problem wasn't assigned, but It's good that you did it.