Question
CS300 pseudocode Document Function Signatures Below are the function signatures that you can fill in to address each of the three program requirements using each
CS300 pseudocode Document
Function Signatures
Below are the function signatures that you can fill in to address each of the three program requirements using each of the data structures. The pseudocode for printing course information, if a vector is the data structure, is also given to you below (depicted in bold).
// Vector pseudocode
int numPrerequisiteCourses(Vector
totalPrerequisites = prerequisites of course c
for each prerequisite p in totalPrerequisites
add prerequisites of p to totalPrerequisites
print number of totalPrerequisites
}
void printSampleSchedule(Vector
}
void printCourseInformation(Vector
for all courses
if the course is the same as courseNumber
print out the course information
for each prerequisite of the course
print the prerequisite course information
}
// Hashtable pseudocode
int numPrerequisiteCourses(Hashtable
}
void printSampleSchedule(Hashtable
}
void printCourseInformation(Hashtable
}
// Tree pseudocode
int numPrerequisiteCourses(Tree
}
void printSampleSchedule(Tree
}
void printCourseInformation(Tree
}
Example Runtime Analysis
When you are ready to begin analyzing the runtime for the data structures that you have created pseudocode for, use the chart below to support your work. This example is for printing course information when using the vector data structure. As a reminder, this is the same pairing that was bolded in the pseudocode from the first part of this document.
Code | Line Cost | # Times Executes | Total Cost |
for all courses | 1 | n | n |
if the course is the same as courseNumber | 1 | n | n |
print out the course information | 1 | 1 | 1 |
for each prerequisite of the course | 1 | n | n |
print the prerequisite course information | 1 | n | n |
Total Cost | 4n + 1 | ||
Runtime | O(n) |
uverview This milestone will help prepare you for Project One. In this milestone, you will continue working on a task for ABC University. ABC University is looking for software that will help their computer science advisors access course information for students. To do this, you will utilize what you have learned about data structures. In this milestone, you will create pseudocode for the Computer Science department at ABCU. This code will demonstrate your ability to import data from a file and store it in the hash table data structure. Prompt For this milestone, you will be creating pseudocode for loading data into a hash table and then using it to store and print that data. There will be no programming work in this milestone; you will be developing pseudocode that will help you implement your design in a future milestone. Please note: Throughout this milestone we are going to use the word "course" to refer to the courses in the curriculum versus "class," which has another meaning in object-oriented programming. For this milestone, you will: 1. Design pseudocode to define how the program opens the file, reads the data from the file, parses each line, and checks for file format errors. The Course Information document, linked in the Supporting Materials section, contains all the information about all of the courses required in the Computer Science curriculum for ABCU. Each line will consist of the information about a single course, including the course number, title, and prerequisites. The Course Information document includes the course data and a diagram of how the program will execute. Your pseudocode will need to validate the sample file to ensure it is formatted correctly and check for the following: - Ensure there are at least two parameters on each line (some courses may not have any prerequisites). - Ensure any prerequisite that is provided on a line exists as a course in the file. In other words, any prerequisite at the end of a line must have another line in the file that starts with that courseNumber. 2. Design pseudocode to show how to create course objects and store them in the appropriate data structure. Your pseudocode should show how to create course objects, so that one course object holds data from a single line from the input file. This should load the data into the hash table data structure. Knowing the file format will help you parse and store each token of data into the appropriate course instance variable. Hint: A loop will be needed to process all lines from the file. 3. Design pseudocode that will print out course information and prerequisites. In the Pseudocode Document, linked in the Supporting Materials section, pseudocode for printing course information using a vector data structure is provided as an example. Develop the pseudocode for printing course information for the hash table data structure using the base code that has been provided
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started