Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please read all instructions and highlight or BOLD any changes made. Thanks! Pseudocode thus far: // Vector pseudocode Open file containing course information Create empty

Please read all instructions and highlight or BOLD any changes made. Thanks!

image text in transcribed

Pseudocode thus far:

// Vector pseudocode

Open file containing course information

Create empty vector to store course objects

Read each line

WHILE file has a next line

Parse each line

Verify at least two parameters on each line

IF (parameters.size()

Display ERROR message

END

Check if prerequisite exists as a course in the file

for p in prerequisites:

found = false

for c in courses:

if (c.courseNumber == p):

found = true

break

IF not found

Display ERROR

END

Create course object

Store course object in vector

CLOSE FILE

Function for searching for a specific course and Display information

Search for the course in the vector

for c in courses:

IF (c.courseNumber == courseNumber)

Print course information

Print prerequisite course information

Verify at least two parameters on each line

IF (parameters.size()

Display ERROR

END

Check if prerequisite exists as a course in the file

for p in prerequisites:

found = false

for c in courses:

IF (c.courseNumber == p):

found = true

BREAK

IF not found

Display ERROR

END

Create a course object

Store course object in vector

CLOSE FILE

Function for searching for a specific course and printing its information and prerequisites

void printCourseInformation(vector courses, string courseNumber)

Search for the course in the vector

for c in courses:

if (c.courseNumber == courseNumber)

Display course information

Display prerequisite course information

// Hashtable pseudocode

open file "courseInformation.csv" for reading

IF file does not exist

Display ERROR and exit

ELSE

create empty hash table "courses"

WHILE a line exists in file

read line

split line into tokens

IF number of tokens is

display ERROR

continue to next line

END IF

IF first token not a number

display ERROR

continue to next line

END IF

IF a third token exists

IF third token not a number

Display ERROR

continue to next line

END IF

check if third token is a key in "courses"

IF not

Display ERROR

continue to next line

END IF

END IF

create new course object with first token as course number, second token as course title, and third as prerequisite

insert course object into "courses" with course number as key

END WHILE

END IF

CLOSE FILE

Create course objects and store in Hash Table

class Course

courseNumber

courseTitle

prerequisite

constructor(courseNumber, courseTitle, prerequisite)

this.courseNumber = courseNumber

this.courseTitle = courseTitle

this.prerequisite = prerequisite

END constructor

END class

Create empty hash table named "courses"

FOR each line

create new course object with line tokens as arguments

insert course object into "courses" with course number as key

END FOR

FOR each key in "courses" hash table

retrieve course object from "courses" hash table

Display courseNumber, courseTitle, and prerequisite

END FOR

Define function to display course info and prerequisites

loop through hash table

FOR (int i = 0; i

IF current index not empty

Create pointer to head of linked list at current index

loop through linked list at current index

Display the course number, title, and prerequisites

loop through prerequisites of the current course

Display prerequisite course number

END WHILE

move to next course in linked list

END IF

END FOR

END

// Tree pseudocode

open file "courseInformation.csv" for reading

IF file does not exist

Display ERROR and exit

ELSE

create empty tree data structure "courses"

WHILE a line exists in file

read line

split line into tokens

IF number of tokens is

display ERROR

continue to next line

END IF

IF first token not a number

display ERROR

continue to next line

END IF

IF a third token exists

IF third token not a number

Display ERROR

continue to next line

END IF

Check if third token exists as a node in "courses"

IF not

Display ERROR

continue to next line

END IF

END IF

create new course object with first token as course number, second token as course title, and third as prerequisite

insert course object as a node in "courses" with the prerequisite as its parent node

END WHILE

END IF

CLOSE FILE

Create course objects and store in Tree Data Structure

class Course

courseNumber

courseTitle

prerequisite

constructor(courseNumber, courseTitle, prerequisite)

this.courseNumber = courseNumber

this.courseTitle = courseTitle

this.prerequisite = prerequisite

END constructor

END class

Define function to traverse and display course info and prerequisites

function displayCourses(node)

display courseNumber, courseTitle, and prerequisite of current node

IF node has children

FOR each child of node

call displayCourses function with child as argument

END FOR

END IF

END

call displayCourses function with root node of "courses" tree data structure as argument

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)

Competencies In this project, you will demonstrate your mastery of the following competencies: - Apply non-coding development methodologies for outlining an algorithmic design - Evaluate complex data structures that solve a given problem using advanced algorithmic designs Scenario The academic advisors in the Computer Science department at ABCU are very happy with the pseudocode you completed. You are now prepared to move forward with expanding the pseudocode to directly respond to the two items advising hopes to accomplish with this program. Remember, your program will need to do the following: 1. Print a list of all the Computer Science courses in alphanumeric order. 2. For a given course, print out its title and prerequisites. You will be writing pseudocode to address each of advising's requirements, and you will do so for each of the data structures you already started to explore in the previous assignments (vector, hash table, and tree). Then you will perform a runtime analysis to determine which data structure will be the best to use when you begin coding in the next project. Directions In previous milestones, you wrote a description for the Course object that will be stored in different data structures. To be able to determine the running time of each of those data structures in this application, you will need to finish writing all the pseudocode for the rest of the code and perform a Big O analysis. Pseudocode 1. Resubmit pseudocode from previous pseudocode assignments and update as necessary. In the previous assignments, you created pseudocode for each of the three data structures (vector, hash table, and tree). Be sure to resubmit the following pseudocode for each data structure. a. Design pseudocode to define how the program opens the file, reads the data from the file, parses each line, and checks for formatting errors. b. Your pseudocode should show how to create course objects, so that one course object holds data from a single line from the input file. c. Design pseudocode that will print out course information and prerequisites. 2. Create pseudocode for a menu. The menu will need to perform the following: a. Load Data Structure: Load the file data into the data structure. Note that before you can print the course information or the sorted list of courses, you must load the data into the data structure. b. Print Course List: This will print an alphanumerically ordered list of all the courses in the Computer Science department. c. Print Course: This will print the course title and the prerequisites for any individual course. d. Exit: This will exit you out of the program. 3. Design pseudocode that will print out the list of the courses in the Computer Science program in alphanumeric order. Continue working with the Pseudocode Document linked in the Supporting Materials section. Note that you will be designing for the same three data structures that you have been using in your previous pseudocode milestones (vector, hash table, and tree). This time you will create the final pieces of pseudocode that you will need for ABCU 's advising program. To complete this part of the process, do the following: a. Sort the course information by alphanumeric course number from lowest to highest. b. Print the sorted list to a display. Evaluation 4. Evaluate the run-time and memory of data structures that could be used to address the requirements. In a previous assignment, you created pseudocode to do the following: a. Define how the program opens the file, reads the data from the file, parses each line, and checks for formatting errors. b. Show how to create course objects, so that one course object holds data from a single line from the input file. Using this pseudocode written for the previous assignments, analyze the worst-case running time of each, reading the file and creating course objects, which will be the Big O value. This should not include the pseudocode written for the menu or the sample schedule above. To do this, do the following: c. Specify the cost per line of code and the number of times the line will execute. Assume there are n courses stored in the data structure. d. Assume the cost for a line to execute is 1 unless it is calling a function, in which case the cost will be the running time of that function. 5. Based on the advisor's requirements, analyze each data structure (vector, hash table, and tree). Explain the advantages and disadvantages of each structure in your evaluation. 6. Now that you have analyzed all three data structures, make a recommendation for which data structure you will plan to use in your code. Provide justification for your recommendation, based on the Big O analysis results and your analysis of the three data structures. What to Submit To complete this project, you must submit the following: Pseudocode and Runtime Analysis Your submission should be formatted in a double-spaced, 1-2 page Word document that includes your completed pseudocode, your runtime analysis in a chart, and your analysis of both the advantages and disadvantages for each structure

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

Evaluate the integral. e 2 sin 3 d

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago

Question

=+1. Do you have insurance?

Answered: 1 week ago

Question

=+ 2. Do you have a license and do you have insurance?

Answered: 1 week ago