Southern New Hampshire University

CS-218: Data Structure and Algorithms

A study guide to SNHU's course on stacks, queues, trees, graphs and hash tables, and the analysis of fast sorting algorithms.

Updated October 2026 · 5 min read

CS-218 is where Southern New Hampshire University computer science students learn the classic data structures and how to judge an algorithm's cost.

SNHU's catalog describes it as exploring fundamental data structures and algorithms such as the stack, queue, tree, graph and hash table, discussing various implementations, and examining commonly used fast sorting algorithms with in-depth analysis of time and memory use. Students implement solutions using appropriate structures and algorithms.

Prerequisites combine programming (CS-210 or CS-217) with mathematics (MAT-230 or MAT-239), and the course needs both: you write the code and reason about its efficiency.

Course at a Glance

ItemDetails
UniversitySouthern New Hampshire University (SNHU)
Course codeCS-218 (catalog title: Data Structure and Algorithms)
LevelUndergraduate, 3 credits
PrerequisitesCS-210 or CS-217, and MAT-230 or MAT-239
Typical workImplementations, complexity analyses, comparisons of sorting algorithms

What CS-218 Covers

StructureKey ideaTypical use
StackLast in, first outUndo, expression evaluation
QueueFirst in, first outScheduling, breadth-first search
TreeHierarchy of nodesSorted data, file systems
GraphNodes joined by edgesNetworks, routes
Hash tableKey mapped to a slotFast lookup

Key Concepts Explained

Big-O Notation

Big-O describes how running time or memory grows as input size n grows, ignoring constants. It lets you compare approaches before writing code.

OperationTypical cost
Array access by indexO(1)
Search in an unsorted listO(n)
Search in a balanced binary search treeO(log n)
Hash table lookupO(1) on average, O(n) worst case

Fast Sorting: Merge Sort and Quicksort

Merge sort splits the list in half, sorts each half and merges them. It runs in O(n log n) in every case but needs extra memory for merging. Quicksort picks a pivot and partitions around it; it averages O(n log n) and sorts in place, but poor pivot choices can push it to O(n²).

Example: Sorting one million records. O(n²) means on the order of 1012 comparisons; O(n log n) means roughly 2 × 107. That gap is why the course focuses on fast sorts and on the memory each one uses.

Hash Collisions

Two keys can map to the same slot. Chaining stores a list at each slot; open addressing probes for another free slot. Keeping the load factor (items divided by slots) low keeps lookups fast.

Example: With 10 slots and the hash "key mod 10", keys 15 and 25 both land in slot 5. With chaining, slot 5 holds both; a lookup for 25 checks just those two items.

Graph Traversal

Breadth-first search uses a queue and explores neighbors level by level, which finds the shortest path in an unweighted graph. Depth-first search uses a stack (or recursion) and goes deep before backtracking.

Typical Assignments and How to Approach Them

Assignment typeWhat it testsHow to approach it
Implement a structureUnderstanding of operationsDraw the structure before and after each operation
Sorting comparisonTime and memory analysisTime runs on growing inputs and compare with Big-O
Problem solvingChoosing a structureJustify the choice by the operations needed most

Binary Search Trees in Practice

A binary search tree keeps every left descendant smaller than its node and every right descendant larger. Searching compares the target with the current node and moves left or right, discarding half the remaining tree at each step when the tree is balanced.

Example: Inserting 50, 30, 70, 20, 40 gives a balanced tree three levels deep; finding 40 takes three comparisons (50, 30, 40). Inserting 10, 20, 30, 40, 50 in sorted order instead produces a chain where every node has only a right child, and finding 50 takes five comparisons. That is the O(n) worst case.

Self-balancing trees, such as AVL and red-black trees, rotate nodes after inserts and deletes to keep the height close to log n. Even if you do not implement one, explaining why balance matters strengthens an analysis.

Memory as Well as Time

SNHU's description calls for analysis of memory use, not just speed. Merge sort typically needs O(n) extra space; in-place quicksort needs only the recursion stack, O(log n) on average. Linked structures use extra memory for pointers, while arrays may waste space when over-allocated.

Where Students Get Stuck

Study Tips for CS-218

How We Help with CS-218

Send the prompt, starter code, your work and feedback. A tutor can explain structures and analysis, help you debug or prepare a commented model implementation to study.

GradeEssays is independent of Southern New Hampshire University. Our work is tutoring and reference help; you write and submit your own code under SNHU's academic integrity policy.

Make Sense of Your CS-218 Work

Share the prompt, files and feedback. A programmer prepares a commented model implementation you can learn from.

Start My CS-218 Help

Free revisions · Full refund if late · Written from scratch for your order

Frequently Asked Questions

What are the prerequisites for CS-218?

SNHU lists CS-210 or CS-217, plus MAT-230 or MAT-239.

How many credits is CS-218?

SNHU lists it as a 3-credit undergraduate course.

Which sorting algorithms should I know?

The catalog mentions commonly used fast sorting algorithms; merge sort and quicksort are the standard examples, often compared with simpler O(n²) sorts.

Why is quicksort's worst case O(n²)?

If pivots repeatedly split the list very unevenly, for example always picking the smallest item, each partition removes only one element.

How is CS-218 different from CS-260?

CS-218 focuses on implementing classic structures and analyzing fast sorts; CS-260's description stresses algorithmic design using coding and non-coding methods.

Can you write my CS-218 code to submit?

No. We provide tutoring and model implementations for study; you submit your own work.