<feed xmlns='http://www.w3.org/2005/Atom'>
<title>DataStructureFundamentalCpp/Sources, branch master</title>
<subtitle>UCSD Data Structures Fundamentals exercises done in C++ https://www.edx.org/course/data-structures-fundamentals-uc-san-diegox-algs201x
</subtitle>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/'/>
<entry>
<title>check if binary search tree harder version done!</title>
<updated>2019-06-13T01:22:10+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-06-13T01:22:10+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=56c652e96dcedf3acbe6f37d9540044b2681b2da'/>
<id>56c652e96dcedf3acbe6f37d9540044b2681b2da</id>
<content type='text'>
Comparing this against my Java and Python code, one more change was
needed: key value type changed from int to long. In reality, I'm not
sure if int would have worked, but I decided to be better safe than
sorry.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Comparing this against my Java and Python code, one more change was
needed: key value type changed from int to long. In reality, I'm not
sure if int would have worked, but I decided to be better safe than
sorry.</pre>
</div>
</content>
</entry>
<entry>
<title>Binary Serach Tree check done!</title>
<updated>2019-06-12T16:33:33+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-06-12T16:33:33+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=36d6a0c2b7c63d52f50e1509deed1f96ff1435d0'/>
<id>36d6a0c2b7c63d52f50e1509deed1f96ff1435d0</id>
<content type='text'>
I was lazy and didn't write test cases for this, because it's more or
less a straight copy from Java code, with minor modifications. In the
process I forgot to check 0 sized vector, and got "unknown signal 11"
segmentation fault error. Easy fix :)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I was lazy and didn't write test cases for this, because it's more or
less a straight copy from Java code, with minor modifications. In the
process I forgot to check 0 sized vector, and got "unknown signal 11"
segmentation fault error. Easy fix :)</pre>
</div>
</content>
</entry>
<entry>
<title>Tree traversal done in C++</title>
<updated>2019-06-10T03:04:26+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-06-10T03:04:26+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=1d2b8a1f4184569e166cc7cab0316bb0259c86d6'/>
<id>1d2b8a1f4184569e166cc7cab0316bb0259c86d6</id>
<content type='text'>
It's not too bad since I worked it out in Java. I didn't use recursive
functions at all to avoid stack overflow issues. Instead, I worked it
out using loop with stacks and queues. Lots of fun!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's not too bad since I worked it out in Java. I didn't use recursive
functions at all to avoid stack overflow issues. Instead, I worked it
out using loop with stacks and queues. Lots of fun!</pre>
</div>
</content>
</entry>
<entry>
<title>Rabin-Karp string search done!</title>
<updated>2019-03-18T00:42:59+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-03-18T00:42:59+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=a7f23160da19ea62e4da660b151cb8f15af8fe8f'/>
<id>a7f23160da19ea62e4da660b151cb8f15af8fe8f</id>
<content type='text'>
Good practice of passing by reference again. First time using string
compare method in C++. Also I guess I'm luck when I started the Java
code using the poly hash function written earlier, therefore I didn't
come across the mod negative issue that I read about. Fun stuff :)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Good practice of passing by reference again. First time using string
compare method in C++. Also I guess I'm luck when I started the Java
code using the poly hash function written earlier, therefore I didn't
come across the mod negative issue that I read about. Fun stuff :)</pre>
</div>
</content>
</entry>
<entry>
<title>Hashing with Chains done!</title>
<updated>2019-03-13T03:27:24+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-03-13T03:27:24+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=9735d05bae6c6cdb86789bc74def31e402c469a3'/>
<id>9735d05bae6c6cdb86789bc74def31e402c469a3</id>
<content type='text'>
Didn't write test cases because the starter code wasn't easy for
testing. Tested using sample input. Fun stuff :)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Didn't write test cases because the starter code wasn't easy for
testing. Tested using sample input. Fun stuff :)</pre>
</div>
</content>
</entry>
<entry>
<title>Phone book done!</title>
<updated>2019-03-10T02:23:45+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-03-10T02:23:45+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=28191582b58f35e9d6d4d28f33cb76f45a08c183'/>
<id>28191582b58f35e9d6d4d28f33cb76f45a08c183</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merging tables done!</title>
<updated>2019-03-05T20:49:08+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-03-05T20:49:08+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=fc4792aca6cb9a96e7ebce39e0416692bbe526ed'/>
<id>fc4792aca6cb9a96e7ebce39e0416692bbe526ed</id>
<content type='text'>
Lots of fun getting this one. I modified the starter code significantly,
so it's more like my Java code (I did deviate away with setID as int).
I'm happy for 2 things:
1. Learned and practiced again of passing by reference and modifying
vector&lt;Table&gt; elements through address
2. Debugging googletests with Eclipse, I tried it and it worked. I had
to click forward a few steps before I can really see variables and their
changes in the debugger. Very nice :)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Lots of fun getting this one. I modified the starter code significantly,
so it's more like my Java code (I did deviate away with setID as int).
I'm happy for 2 things:
1. Learned and practiced again of passing by reference and modifying
vector&lt;Table&gt; elements through address
2. Debugging googletests with Eclipse, I tried it and it worked. I had
to click forward a few steps before I can really see variables and their
changes in the debugger. Very nice :)</pre>
</div>
</content>
</entry>
<entry>
<title>Parallel processing job queue done!</title>
<updated>2019-02-24T21:33:28+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-02-24T21:33:28+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=cf6f4a6dcb62c21b5f498396d01e5323d42852a7'/>
<id>cf6f4a6dcb62c21b5f498396d01e5323d42852a7</id>
<content type='text'>
I used C++'s priority_queue (queue.h) and C++'s own pair data structure.
Unlike Python and Java's similar data structure, C++'s priority_queue
pops in reverse order, so I had to negate the value, and negate back
when adding them to vectors. Cool use of pair. Fun stuff :)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I used C++'s priority_queue (queue.h) and C++'s own pair data structure.
Unlike Python and Java's similar data structure, C++'s priority_queue
pops in reverse order, so I had to negate the value, and negate back
when adding them to vectors. Cool use of pair. Fun stuff :)</pre>
</div>
</content>
</entry>
<entry>
<title>Build heap done!</title>
<updated>2019-02-20T04:17:57+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-02-20T04:17:57+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=8047395062ce2234a94e35dadf11d8f29ecfb2ac'/>
<id>8047395062ce2234a94e35dadf11d8f29ecfb2ac</id>
<content type='text'>
It turned out it's more challenging converting Java code to C++ this
time. The for loop, commented in the code, was tricky! The while loop
was better anyway. It was good practice of doing debugging with gdb.
Once again, rewarding experience!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It turned out it's more challenging converting Java code to C++ this
time. The for loop, commented in the code, was tricky! The while loop
was better anyway. It was good practice of doing debugging with gdb.
Once again, rewarding experience!</pre>
</div>
</content>
</entry>
<entry>
<title>Network packet done.</title>
<updated>2019-01-30T01:32:20+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2019-01-30T01:32:20+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/DataStructureFundamentalCpp/commit/?id=0d8f4fa39c349e2d26056be70a39a95ae15da7d6'/>
<id>0d8f4fa39c349e2d26056be70a39a95ae15da7d6</id>
<content type='text'>
Fun exercise. Good comparison and contrast with Java.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fun exercise. Good comparison and contrast with Java.</pre>
</div>
</content>
</entry>
</feed>
