======Part 2====== =====Entries===== ====Entry 1: October 31, 2012==== Today in Data structures we learned about binary trees. I didn't really see the point of it, until Matt showed how we can use it for sorting. It seems pretty awesome. The difficult part will be working out the algorithms - but when it comes time to creating a program for binary trees, I will probably choose the recursive method since that is what I'm least familiar with. ====Entry 2: October 31, 2012==== For Discrete we've been working on a set program part 2. Basically we have to be able to build 2 sets, display 3 sets (third one is a 'result' set), union the 2 sets, intersect the 2 sets, and take a difference between sets A and B and between B and A. Also clear the sets. I used iterative algorithms for this program and it was quite a pain after awhile - the algorithms are getting increasingly complex and long. I'm betting a recursive method would have worked much better - if we have another set program I would probably try that instead. ====Entry 3: October 31, 2012==== For comp. org. I set up a directory and have an increment and decrement up and running. I set up a bncreate, and a setnum function as well. The next stage is where it gets a little repetitive (ad where Andrew may or may not come into play) and that is writing the C code that would complement the LD functions. For LD functions I am thinking that since there are only a certain of possibilities it may just be better to 'hardcode' them into if statements and taking command line arguments. Eventually, and I would probably need Matts help with this, there will be scripts that will actually be responsible for calling the LD functions and responsible for sending the command line argument to them. ====Entry 4: October 31, 2012==== The asterisk project has pretty much winded down. We've been unable to get the new machine working properly - it connects but no sound gets transmitted. We did connect it to a coffee maker and a lightbulb though so that was cool. Now we are going to use a program called minimodem which takes a file input and then outputs it as sound (like the dialup sound). This sound will be transmitted through two cans and a string, and then received into a machine running the program in receiving mode. So we could hopefully transmit a photo using two cans and a string. =====Keywords===== {{page>asmpart2&nofooter}} {{page>datapart2&nofooter}} {{page>datacommpart2&nofooter}} {{page>discretepart2&nofooter}} =====Experiment 2===== ====Question==== For passing linked lists to functions and keeping track of the changes made without using a return, I had to use double pointers. What I would do is send the single Node pointer to the function by address - and define it as a double pointer in the function while dereferencing it once whenever it was used within the function. What I was curious was would it be the same thing if I defined a double Node pointer in the main function, and just sent that without any dereferencing to the functions? It should be the same thing --- it's still a double pointer after all. ====Resources==== This is basically more pointer playfulness. So all of the knowledge was gained last year from C/C++ Programming and from Matt. ====Hypothesis==== I figured that it would work the same - since I am effectively doing the same thing, just shifting the notation by a little bit. ====Experiment==== I tried to use this slightly different method in my stack program. ====Data==== When I tried this - I kept running into seg faults. When I talked about this with Matt, he figured it would be a malloc issue. Using the debugger, I figured out that even the pointers WEREN'T BEING GIVEN AN ADDRESS. So the pointer, was completely null. It didn't point to something. The pointer itself was null. Therefore, I couldn't pass it. My workaround was to create some variables and set their addresses equal to the pointers. I also had to implement two layers of mallocing. It was a gigantic pain, and the end result was that it sort of worked. In the end, I resorted to passing single pointers by address :). ====Analysis==== My hypothesis was half true.\\ It is applicable.\\ There is more going on than I thought - there were malloc issues that had to kind of manually be resolved, and it was a gigantic pain figuring it all out.\\ There were no shortcomings - I was able to test my hypothesis nicely.\\ The data is pretty nice about indicating that one would not want to accomplish this task this way.\\ ====Conclusions==== Pass the single pointer by address.