<feed xmlns='http://www.w3.org/2005/Atom'>
<title>AlgoDesignAndTechniqueEdxPython, branch master</title>
<subtitle>UCSD Algorithmic Design and Techniques exercises done in Python. https://www.edx.org/course/algorithmic-design-techniques-uc-san-diegox-algs200x
</subtitle>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/'/>
<entry>
<title>Max expression value by placing paren done!</title>
<updated>2018-12-29T00:05:45+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-29T00:05:45+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=6eac7fac3f842cadb88b068635e17a79108897f6'/>
<id>6eac7fac3f842cadb88b068635e17a79108897f6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Kanpsack partition3 done!</title>
<updated>2018-12-27T16:20:17+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-27T16:20:17+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=f32e2e8777d12869ce9e82aee1e3b9cc9e87f0f6'/>
<id>f32e2e8777d12869ce9e82aee1e3b9cc9e87f0f6</id>
<content type='text'>
Not sure how scientific this comparison is, but I've got Max time used:
0.03/10.00, max memory used: 10264576/536870912.), and bytwigorlimerick
got Max time used: 0.04/10.00, max memory used: 10260480/536870912.).
https://courses.edx.org/courses/course-v1:UCSanDiegoX+ALGS200x+2T2017/discussion/forum/course/threads/5a4290cc44a15008b5000768
Looks like we are using different approaches.
Funny that my approach is a bit faster than</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Not sure how scientific this comparison is, but I've got Max time used:
0.03/10.00, max memory used: 10264576/536870912.), and bytwigorlimerick
got Max time used: 0.04/10.00, max memory used: 10260480/536870912.).
https://courses.edx.org/courses/course-v1:UCSanDiegoX+ALGS200x+2T2017/discussion/forum/course/threads/5a4290cc44a15008b5000768
Looks like we are using different approaches.
Funny that my approach is a bit faster than</pre>
</div>
</content>
</entry>
<entry>
<title>Knapsack maximize gold done!</title>
<updated>2018-12-27T00:15:59+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-27T00:15:59+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=a8bdf7580ae3c6b55554b965810aeb48517d7af1'/>
<id>a8bdf7580ae3c6b55554b965810aeb48517d7af1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Longest subsequence done! (3 seqs)</title>
<updated>2018-12-25T22:42:27+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-25T22:42:27+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=61ffe2a9e5fd066dae82a32185bbfe821696bd8a'/>
<id>61ffe2a9e5fd066dae82a32185bbfe821696bd8a</id>
<content type='text'>
The only tricky part was to create and populate the 3-d list. The
instructions here was helpful:
https://www.ict.social/python/basics/multidimensional-lists-in-python</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The only tricky part was to create and populate the 3-d list. The
instructions here was helpful:
https://www.ict.social/python/basics/multidimensional-lists-in-python</pre>
</div>
</content>
</entry>
<entry>
<title>Longest subsequence of 2 seqs done!</title>
<updated>2018-12-25T20:27:29+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-25T20:27:29+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=b12193500c0da24a9e7fc5a8523ed2252da88bad'/>
<id>b12193500c0da24a9e7fc5a8523ed2252da88bad</id>
<content type='text'>
Not too bad, since I worked it out in Java already.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Not too bad, since I worked it out in Java already.</pre>
</div>
</content>
</entry>
<entry>
<title>Edit distance done!</title>
<updated>2018-12-22T21:11:02+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-22T21:11:02+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=33b21ee9aad03b052d14227e023b9697c6ce4a55'/>
<id>33b21ee9aad03b052d14227e023b9697c6ce4a55</id>
<content type='text'>
It turned out my Java test cases didn't cover enough number of cases. I
added one test case for it to fail, and figured out that the range in 2
loops should start with 1.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It turned out my Java test cases didn't cover enough number of cases. I
added one test case for it to fail, and figured out that the range in 2
loops should start with 1.</pre>
</div>
</content>
</entry>
<entry>
<title>Primitive calculator done!</title>
<updated>2018-12-20T03:28:32+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-20T03:28:32+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=c023f45e82a5631319563be730f5e7aea9eee861'/>
<id>c023f45e82a5631319563be730f5e7aea9eee861</id>
<content type='text'>
This isn't too bad after I worked out the algo in Java first.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This isn't too bad after I worked out the algo in Java first.</pre>
</div>
</content>
</entry>
<entry>
<title>Coin change Dynamic Programming done!</title>
<updated>2018-12-18T03:36:34+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-18T03:36:34+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=42b954fb8365969c979c5cd1f3c1cd9ed1f7ffc9'/>
<id>42b954fb8365969c979c5cd1f3c1cd9ed1f7ffc9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Closest pair done!</title>
<updated>2018-12-17T02:21:12+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-17T02:21:12+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=1d6a57ac37f0c56a7639c1124be5501f699f3027'/>
<id>1d6a57ac37f0c56a7639c1124be5501f699f3027</id>
<content type='text'>
I thought it wouldn't be this hard after I worked it out in Java first,
but once again it was fun and I learned a lot:
1. in all my previous exercises, my Python code performed better than my
Java code. This is the first time that my Java code significantly
outperforms my Python code: 0.92 seconds versus 7.93 seconds! My Java
code did use more than twice the memory.
2. Good re-enforcement of Python list copying concept, versus aliasing.
Don't forget the [:] (or [l:r]) magic!
3. list of (num, num) sort by first num by default, with proper tie
breaking. To sort on the second num, do list.sort(key=lambda x: x[1].
Cleve use of lambda, and it also does proper tie breaking.
4. I forgot to put this into my Java program comments, that Java code
gave me a good practice of comparator versus comparable interfaces,
which was very nice.

Fun stuff! Curious how much faster C++ program will be. I'll find out!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I thought it wouldn't be this hard after I worked it out in Java first,
but once again it was fun and I learned a lot:
1. in all my previous exercises, my Python code performed better than my
Java code. This is the first time that my Java code significantly
outperforms my Python code: 0.92 seconds versus 7.93 seconds! My Java
code did use more than twice the memory.
2. Good re-enforcement of Python list copying concept, versus aliasing.
Don't forget the [:] (or [l:r]) magic!
3. list of (num, num) sort by first num by default, with proper tie
breaking. To sort on the second num, do list.sort(key=lambda x: x[1].
Cleve use of lambda, and it also does proper tie breaking.
4. I forgot to put this into my Java program comments, that Java code
gave me a good practice of comparator versus comparable interfaces,
which was very nice.

Fun stuff! Curious how much faster C++ program will be. I'll find out!</pre>
</div>
</content>
</entry>
<entry>
<title>Organize lottery done.</title>
<updated>2018-12-10T01:23:30+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-10T01:23:30+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxPython/commit/?id=88a15736625e2847d5c479ceabf202ea6be1e75b'/>
<id>88a15736625e2847d5c479ceabf202ea6be1e75b</id>
<content type='text'>
It wasn't hard since I worked this out in Java first. Once again, I felt
Python is really well designed and efficient.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It wasn't hard since I worked this out in Java first. Once again, I felt
Python is really well designed and efficient.</pre>
</div>
</content>
</entry>
</feed>
