CS 152 Kickoff & Course Overview

Fred Agbo

2025-08-25

Announcements

  • Welcome to CS152: Data Structure
  • Things to do:
    • Access the course webpage on Canvas
    • Read over the full syllabus carefully
    • Join the class communication/announcements on Discord Server.!
    • Use the instruction on the Resources menu in week 1 to setup your environments
      • We will go over them briefly in class

Introduction

Let’s get to know one another…

My Vitals

Name: Professor/Dr Fred Agbo
Office: Ford 209
Office Hours: T, TH 10:30-12:00pm Online or anytime I’m around
Email: fjagbo at willamette.edu
Office Phone: 503-370-6862

Syllabus Check

Textbook Materials for this course

  • Two main textbooks are used in this course (next slide)
  • Other supplementary resources are provided too
  • NOTE! We are no more using CODEGRADE for the class. Apologies!!
    • CODEGRADE ENROLLMENT CREDIT By codegrade has been removed from the Bookstore
    • If you have purchased this, contact them for refund

Textbook Materials for this course

  • Fundamentals of Python Data Structures (2nd Ed) by Kenneth Lambert

  • Data Structures & Algorithms in Python (1st Ed) by John Canning, Alan Broder, and Robert Lafore

Weekly Reading & Book Chapter Mapping

Grading

  • Weekly Reading, Class Attendance, and Participation in Class Activities - 40%
  • Assignments & Mini Projects - 25%
  • A Midterm - 15%
  • A Final Exam - 20%

Homework

  • All will be due on Mondays at 10:00pm
  • Submissions will be handled through Github Classroom
  • No late submission
  • Extensions for any reason must be requested and approved by myself before the due date
    • Max extention is 24 hrs

More on course structure and policy

Why Data Structures Matters

Why Studying Data Strecture

  • Data structures are fundamental to efficient problem solving in computer science
  • They help organize, manage, and store data for optimal access and modification
  • Choosing the right data structure can dramatically improve program performance
  • Many real-world applications (search engines, databases, games) rely on effective use of data structures
  • Understanding data structures prepares you for technical interviews and advanced coursework

Why Studying Data Strecture

  • Data Structures often provide a model of the real-world problem they help solve. Examples:
    • People waiting in line to buy tickets
    • Issuing lottery tickets then picking and finding the winner
    • Maintaining a group of contacts with changing attributes like phone numbers, app handles, residences, and even names
  • The data structure must make the most common operations efficient for that problem domain

What is a Data Structure?

  • A data structure is a representation of the logical relationship existing among elements of data.
  • It provides a way to organize, store, and manage data efficiently.
  • Examples include arrays, linked lists, stacks, queues, trees, and graphs.
  • The choice of data structure impacts how you access, modify, and process data in your programs.

Primitive and Non-Primitive Data Structures

  • Primitive Data Structures
    • Directly operated upon by machine instructions
    • Examples: int, float, char, boolean.
  • Non-Primitive Data Structures
    • Built using primitive data types
    • Can store multiple values and complex relationships
    • Examples: arrays, lists, stacks, queues, trees, graphs

Non-Primitive Data Structure

  • Arrays
    • Single Dimension Arrays
      • Store elements in a linear sequence
      • Example in Python:
      numbers = [10, 20, 30, 40, 50]
    • Multi-Dimensional Arrays
      • Store elements in a grid or matrix (e.g., 2D, 3D)
      • Example in Python (2D array):
      matrix = [[1, 2], [3, 4], [5, 6]]

Non-Primitive Data Structure

  • Lists
    • Linear
      • Stack
      • Queue
      • Linked List
    • None Linear
      • Trees
      • Graphs

The Four Primary Operations

  • Insertion: Add a new element to the data structure.
  • Deletion: Remove an existing element from the data structure.
  • Traversal: Access each element of the data structure systematically.
  • Searching: Find the location of a specific element within the data structure.

So Many Data Structures: Why?

  • Different data structures excel at different things.
    • Some are highly specialized, while others (like arrays) are more generally used.
  • The more time you spend as a developer, the more likely you’ll need to use one of these data structures
  • You’ve already worked with many of them knowingly or unknowingly 🤓
  • Job interviews often include data structure questions.

So Many Data Structures: Why?

  • For example, you might be asked to implement a stack or explain when to use a hash table.
  • Knowing the strengths and weaknesses of each data structure helps you solve these problems efficiently and impress interviewers.

THERE IS NO ONE “BEST” DATA STRUCTURE

😎

Data Structure Selection Cheat Sheet

Data Structure Best For Example Use Case
Array Fast access by index, fixed size Storing scores, pixel data
Linked List Frequent insertions/deletions Undo history, playlist
Stack Last-in, first-out (LIFO) Function calls, browser history
Queue First-in, first-out (FIFO) Print jobs, task scheduling
Tree Hierarchical data File systems, organization charts
Graph Relationships/networks Social networks, maps

Choose based on your problem’s needs: speed, memory, and operations!

Overview of Programming in Python

Why Python?

  • Python is widely used for teaching data structures due to its simplicity and readability.
  • It supports multiple programming paradigms: procedural, object-oriented, and functional.
  • Rich standard library and community support make it ideal for rapid prototyping and learning.

Programming Paradigms in Python

  • are styles or approaches to programming, each with its own philosophy and techniques for organizing code.
  • Python is a versatile language that supports several major paradigms, allowing you to choose the best approach for your problem.

1. Procedural Programming

  • Focuses on procedures or routines (functions) to operate on data.
  • Code is organized as a sequence of instructions.
  • Emphasizes step-by-step execution and modularity.
  • Common in scripts and small programs.

Example:

def greet(name):
    print(f"Hello, {name}!")

greet("Alice")

2. Object-Oriented Programming (OOP)

  • Organizes code around objects, which combine data and behavior.
  • Uses classes to define blueprints for objects.
  • Supports concepts like inheritance, encapsulation, and polymorphism.
  • Useful for modeling complex systems and reusable code.

Example:

class Dog:
    def __init__(self, name):
        self.name = name

    def bark(self):
        print(f"{self.name} says woof!")

my_dog = Dog("Buddy")
my_dog.bark()

"""Output: Buddy says woof! """

3. Functional Programming

  • Treats computation as the evaluation of mathematical functions.
  • Avoids changing state and mutable data.
  • Uses higher-order functions, map, filter, and lambda expressions.
  • Encourages concise and expressive code.

Example:

numbers = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x **2, numbers))
print(squared)

"""Output: [1, 4, 9, 16, 25]"""

Each paradigm offers unique strengths. Python lets you mix and match these styles, so you can write code that is clear, maintainable, and efficient for your needs.

Reading Chapter Reminder

  • Fundamentals of Python Data Structures (FDS) - Lambert: ,
    • Chapters 1 & 2
  • Data Structures & Algorithms in Python (DS&A) - John et al.:
    • Chapter 1