Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TREE DATA STRUCTURE ONLY. The Hash Table pseudocode I have included at the bottom is for reference only! the Pseudocode for the tree data structure

TREE DATA STRUCTURE ONLY. The Hash Table pseudocode I have included at the bottom is for reference only! the Pseudocode for the tree data structure needs to be written in the same manner as the hash table reference below.

image text in transcribed

image text in transcribed

// Hashtable pseudocode (REFERENCE ONLY)

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

Overview 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 tree data structure. Prompt For this milestone, you will be creating pseudocode for loading data into the tree data structure. 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. Also note that 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 objectoriented 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. Knowing the file format will help you parse and store each token of data into the appropriate course object instance variable. You should store each course object into the vector data structure. Once the entire file has been processed, the vector data structure will have multiple course objects, one per line in the file. 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, pseudocode for printing course information using a vector data structure is provided as an example. Develop the pseudocode for printing course information for the tree data structures using the base code that has been provided. Course List This document outlines all of the courses that the advising team will need you to include in the program you are developing. Once you start coding, the same information will be provided to you in a text file that can be used as an input for your program. For now, you only need to understand all of the course data inputs and will reference them while you create your pseudocode. Note that the course data is composed of comma-separated values and contains the fields courseNumber, name, prerequisite1, prerequisite2,...,prerequisiteN. While the courseNumber and name will be shown on every line, a course may have 0,1 , or more prerequisites. A prerequisite will be listed using only its courseNumber. The course data is as follows: CSCI100, Introduction to Computer Science CSCI101, Introduction to Programming in C++, CSCI 100 CSCI200, Data Structures, CSCI 101 MATH201, Discrete Mathematics CSCI300, Introduction to Algorithms, CSCI200, MATH201 CSCI301, Advanced Programming in C++, CSCI101 CSCI350, Operating Systems, CSCI 300 CSCI400, Large Software Development, CSCI 301, CSCI 350 Flowchart To get started with your design, you could create a flowchart and diagram how the program will execute. If you were to visualize this as a flowchart, the above curriculum would look like this

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

5. Benchmark current training practices.

Answered: 1 week ago