Algorithmic runtime analysis of pseudocode for various data structures
This project involved creating the pseudocode to store the courses in a data structure (vector, hash table, or binary search tree) that would allow me to quickly access them, then complete a runtime analysis on each structure, then create the code of one of the data structures (based on the runtime analysis). These courses included a course number (like "CSCI101"), a course name (like "Introduction to C++"), and 0-n prerequisites in the form of other course's numbers (ex. CSCI300 could have prerequisites of CSCI101 and CSCI200). I eventually decided to use a vector, because the runtime analysis told me that I could store the courses in it and print from it the fastest.
My first step was to create a way to store the courses in one structure (called "Course"). This would allow me to easily insert/delete them from data structures later on. Next, I had to read the input file that contained the courses, and store them in Course structure. Finally, I created functions for for the vector data structure that would be able to insert, remove, and search for the courses. The important part here was to understand how vectors work, and how to make the most use out of them. For example, understanding that the most efficient way to store something in a vector was to put it at the end allowed for the fastest possible approach.
The biggest roadblock I faced in this project was reading the file into the Course structure. This was mainly because the courses didn't have a set number of prerequisites. In order to store them in a vector, they all had to be the same. To fix this, I initialized a vector within the Course structure that could be filled with the prerequisites. So essentially, the vector of courses was actually a vector of two strings and another vector for each course (course number, course name, course prerequisites).
How has your work on this project expanded your approach to designing software and developing programs?
The biggest thing I learned on this project is the value of writing pseudocode before coding. This would've been a very complicated task to try to code by itself, and the pseudocode kept it organized and simple. Also, I could really see the importance of breaking down a large problem and solving it one step at a time. At first I was trying to figure out how to read the file directly into the vector data structure, which proved to be extremely complicated. Once I realized that I could simply read the file into a unique structure, it made the entire project much more straightforward.
How has your work on this project evolved the way you write programs that are maintainable, readable, and adaptable?
The most challenging part of this project was the fact that the courses didn't have the same amount of prerequisites. This meant that I couldn't do perform the same operation on each course, and that I had to allow for the differences between the courses. Though this was difficult, it makes for more useful code, because the courses don't have to be given to it in such a structured format. This is something I will carry onto my future projects, as it will only make things easier for everyone.