100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CS 300 – Analysis & Design | Assignment 4-2 – Hash Tables |SNHU| – Pseudocode, Reflection, and Complete C++ Code| Grade A

Rating
-
Sold
-
Pages
10
Grade
A
Uploaded on
28-12-2025
Written in
2025/2026

This document covers CS 300 Assignment 4-2 and focuses on implementing a hash table to store, search, display, and remove bid records loaded from a CSV file. It includes structured pseudocode, a written reflection, and full C++ source code demonstrating hashing, collision handling with chaining, and efficient data retrieval. The assignment highlights modular design, defensive programming, and performance considerations when working with dynamic data structures.

Show more Read less
Institution
Analysis & Design
Course
Analysis & Design









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Analysis & Design
Course
Analysis & Design

Document information

Uploaded on
December 28, 2025
Number of pages
10
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Content preview

Assignment 4-2 Hash Tables

Pseudo code
MAIN PROGRAM
Set default CSV path and bid key.
Create a new HashTable object.
Display menu until user chooses Exit:
If user selects Load Bids:
Call loadBids(csvPath, hashTable)
If user selects Display All Bids:
Call hashTable.PrintAll()
If user selects Find Bid:
Call hashTable.Search(bidKey)
Display result if found
If user selects Remove Bid:
Call hashTable.Remove(bidKey)

FUNCTION loadBids(csvPath, hashTable)
Display message indicating file load attempt.

Open CSV file using parser.
For each row in the file:
Create new Bid
Extract bidId, title, fund, and amount
Insert bid into hash table
CLASS HashTable
FUNCTION Insert(bid)
Compute key using hash(bidId)
If bucket is empty:
Store bid at bucket
Else:
Traverse linked list
Add new node at end
FUNCTION Search(bidId)
Compute key
Traverse list at bucket
If bidId matches, return bid
Else return empty bid
FUNCTION Remove(bidId)
Compute key
Traverse list to locate matching bid
If found:
Remove node and adjust links

FUNCTION PrintAll

, For each bucket:
Traverse nodes and print bid data


2. Reflection

Developing this program allowed me to deepen my understanding of how hash tables
function. Also it helped me understand how important design decisions, such as collision
handling and hashing strategy can impact performance and reliability. One of the main
challenges I encountered was ensuring that the CSV file loaded correctly, especially when
the file path was incorrect or the file was not stored in the expected directory. This
produced runtime errors from the CSV parser, which I fixed by adding a file-existence check
and improving exception handling. These issues helped me to reinforce the value of
defensive programming and the importance of validating assumptions before processing
data.

Another key part of the assignment was improving modularity and readability. Separating
the hash table operations into clearly defined methods made the code easier to understand,
debug, and reuse. Consistent naming conventions, comments, and whitespace helped keep
the logic organized and clear for future maintenance. Therefore, completing this project
strengthened my ability to design data structures in a modular way and taught me how to
debug more effectively when working with external data and dynamic memory.


3. Code

//========================================================================
====
// Name : HashTable.cpp
// Author : TESTBANKSNERD
// Version : 1.0
// Copyright : Copyright � 2023 SNHU COCE
// Description : Lab 4-2 Hash Table
//========================================================================
====

#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <time.h>
#include "CSVparser.hpp"

using namespace std;

const unsigned int DEFAULT_SIZE = 179;

// Forward declaration

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TestbanksNerd Ohio State University College Of Medicine
View profile
Follow You need to be logged in order to follow users or courses
Sold
71
Member since
1 year
Number of followers
0
Documents
429
Last sold
1 day ago
TestBanks Nerd

Welcome to TestBanks Nerd – the ultimate hub for academic resources. Here, you’ll find a wide selection of test banks, solution manuals, study notes, lecture summaries, practice exams, and past papers carefully curated to help students succeed. Whether you’re preparing for an exam, revising core concepts, or looking for step-by-step solutions, this store provides accurate, reliable, and exam-focused materials across multiple subjects and editions. At TestBanks Nerd, we make studying smarter, faster, and easier.

Read more Read less
3.8

12 reviews

5
6
4
1
3
2
2
2
1
1

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions