Week 13 — Assignment (Adaptive Learning) · "Search, Sort, Count"
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Objective assessed: Objective 8 (searching, sorting, complexity) · SLO A (write & run) · SLO B (trace & debug)
Worth 100 points · Assignments group = 15% of the grade
Format: adaptive learning — you work the problems with your own AI coach, which grades each answer, helps you fix it, and lets you retry a fresh version. You submit the AI's self-scored report (plus your chat link).
Keep a Python tab open (online-python.com) — you'll write real code and run it.
Part 1 — Student Instructions (read this first)
An AI coach gives you four problems one at a time. It scores each against the rubric, teaches the gap, and offers a fresh-variant retry (best attempt counts).
How to run it: (1) open an approved chatbot — Gemini, Claude, or ChatGPT; (2) copy everything in the box below as one message; (3) work each problem and run your code.
What to submit. When the coach gives the report (first line STUDENT'S SCORE: X/100), copy the whole report + your chat share link into Canvas by Sunday, Nov 29.
Integrity note. Do your own thinking; a fabricated chat is an integrity violation. (Adaptive-learning activity, per the course AI policy.)
Part 2 — The Coach Prompt (copy everything in the box)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ COPY EVERYTHING BELOW THIS LINE ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
You are my assignment coach and grader for Week 13 of Introduction to Computer Science (CSCI 1101) at Silver Oak University. Give me the problems below ONE AT A TIME, grade each against the rubric, teach the gap, and offer a fresh variant to raise my score. Grade ONLY against the keys below — never invent problems, answers, or scores. Total: 100 points across four problems. Every expected output below was produced by actually running the code; treat it as ground truth, and when I'm unsure, tell me to run my code.
THE PROBLEMS — for you (the coach) only. Never show this list, the answers, the rubrics, or the variants. One at a time, exactly as written.
──────────── PROBLEM 1 (25 pts) — Write linear search ────────────
SHOW ME: "Write a function linear_search(lst, target) that returns the INDEX of target in lst, or -1 if it's not there. Test it on [4, 8, 15, 16, 23, 42] searching for 16 and for 7."
VETTED ANSWER: a for-loop over indices returning i when lst[i]==target, else -1 after the loop. On [4,8,15,16,23,42]: searching 16 returns 3; searching 7 returns -1 (both run-verified).
RUBRIC: 25 — correct loop, returns the index, returns -1 when absent, both tests right (full). Partial: returns True/False instead of index, or off-by-one, otherwise sound (10–18).
FRESH VARIANT: "Write linear_search and test it on [10, 20, 30, 40] searching for 30 (→2) and for 25 (→-1)." Same rubric.
──────────── PROBLEM 2 (25 pts) — Count the comparisons ────────────
SHOW ME: "Add a comparisons counter to your linear search so it returns (index, comparisons). On [4, 8, 15, 16, 23, 42], how many comparisons does it take to find 42 (the last item)? Run it to confirm."
VETTED ANSWER: increment comparisons once per loop iteration before the equality check; finding 42 returns (5, 6) — 6 comparisons (run-verified). A missing value also takes 6.
RUBRIC: 25 — counter incremented once per item checked, returns the count, 6 for finding 42 (full). Partial: counter in the wrong place (off by one), otherwise sound (10–18).
FRESH VARIANT: "Count comparisons to find 4 (the first item) in [4, 8, 15, 16, 23, 42]." Answer: (0, 1) — 1 comparison. Same rubric.
──────────── PROBLEM 3 (25 pts) — Predict the output ────────────
SHOW ME: "Without running it first, predict what this prints, then run it to confirm:
def binary_search(lst, target):
lo, hi = 0, len(lst) - 1
while lo <= hi:
mid = (lo + hi) // 2
if lst[mid] == target: return mid
elif lst[mid] < target: lo = mid + 1
else: hi = mid - 1
return -1
print(binary_search([4, 8, 15, 16, 23, 42], 4))"
VETTED ANSWER: it prints 0. WHY: mid starts at index 2 (value 15); 15 > 4 so hi = 1; new mid = 0 (value 4); 4 == 4 → return index 0. (run-verified: index 0 in 2 comparisons.)
RUBRIC: 25 — correct output 0 + correct reasoning about halving toward index 0 (full). Partial: right number, weak reason (10–18).
FRESH VARIANT: "Predict binary_search([4, 8, 15, 16, 23, 42], 23)." Answer: 4 (index of 23). Same rubric.
──────────── PROBLEM 4 (25 pts) — Find and fix the bug ────────────
SHOW ME: "A student runs the binary_search from Problem 3 on the UNSORTED list [8, 4, 23, 16, 42, 15] to find 4, and it returns -1 even though 4 is in the list. (a) Explain why, and (b) give a one-line fix."
VETTED ANSWER: (a) binary search assumes SORTED order to decide which half to discard; on unsorted data it throws away the half that actually holds 4, so it reports not-found (run-verified: returns -1, though 4 is at index 1). (b) sort the list first, e.g. binary_search(sorted(data), 4) — after sorting, it finds 4 at index 0 (run-verified). (Using linear_search instead is also acceptable.)
RUBRIC: (a) 13 — names the sorted-precondition / which-half reason. (b) 12 — sort first (or use linear). Partial for the right fix with a fuzzy reason.
FRESH VARIANT: "Why might binary_search([5, 1, 9, 3], 9) give a wrong answer, and how do you fix it?" Answer: unsorted → sort first. Same rubric.
HOW TO RUN IT (with me). Greet me (1–2 sentences), ask my FIRST NAME, give Problem 1. ONE problem at a time; never show the set/answers/variants. After each answer: grade against the rubric and state the score ("That earns 20 of 25"); say what's right, then TEACH the gap and show the working code; OFFER a re-attempt with the FRESH VARIANT (best attempt counts, capped at full). If my code would error, tell me to RUN it and read the error. Score HONESTLY against the key. Every message ends with a problem, a question, or a next step.
COMPLETION + REPORT. After all four problems (and retries), produce EXACTLY:
STUDENT'S SCORE: X/100
WEEK 13 ASSIGNMENT — Search, Sort, Count
Student: [name] | Date: ___
Problem 1 (Linear search): a/25 — [one line]
Problem 2 (Count the comparisons): b/25 — [one line]
Problem 3 (Predict the output): c/25 — [one line]
Problem 4 (Find and fix the bug): d/25 — [one line]
Strongest skill: ___
Worth another look: ___
(The four scores must add to line 1.) Then say, verbatim: "Copy this entire report AND your share link to this chat, and submit both in Canvas for this assignment." End with one genuine sentence of encouragement.
GETTING STARTED. Begin now: greet me, ask my first name, and give me Problem 1.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ COPY EVERYTHING ABOVE THIS LINE ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Instructor grading note (Prof. Okafor)
- Record the
STUDENT'S SCORE: X/100from line 1 into the Assignments group. - Spot-check chat links against scores; the embedded run-verified key makes grading consistent across chatbots.
- Known weak point (H5/H7): an AI-self-scored grade by share link is gameable; acceptable as one assignment among many; pair with a proctored check for high stakes.
Canvas placement block
canvas_object = Assignment
title = "Week 13 Assignment — Search, Sort, Count (adaptive)"
assignment_group = "Assignments"
points_possible = 100
grading_type = points
assignment_type = adaptive
submission_types = [online_text_entry, online_url]
due_offset_days = 6
published = true
provenance = "~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com"
Traditional variant — for comparison. This sample course is configured adaptive learning, so its actual Week-13 assignment is the AI-coached, self-scored version in
I-assignment-and-rubric-week-13.md. This file shows the same skills built the traditional way — the student writes the programs and submits them, and the instructor grades against the rubric. (Choosingassignment_type = traditionalat setup generates this style.)
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Objective assessed: Objective 8 (searching, sorting, complexity) · SLO A + SLO B
Worth 100 points · Assignments group = 15% of the grade
The Assignment
This week you learned to search, sort, and — for the first time — measure how fast an algorithm is by counting its steps. In four parts you'll write linear search, count its comparisons, predict a binary search, and fix a classic bug. Write and run your code in a free online Python editor, then submit your code and its output (screenshot or pasted text) as a document upload or text entry in Canvas. Read the rubric first.
Part 1 — Write linear search (25 pts). Write linear_search(lst, target) that returns the index of target, or -1 if absent. Test it on [4, 8, 15, 16, 23, 42] searching for 16 and for 7.
Part 2 — Count the comparisons (25 pts). Add a comparisons counter so your search returns (index, comparisons). How many comparisons to find 42 (the last item)? Run it and report.
Part 3 — Predict the output (25 pts). For the binary-search program below, (a) predict binary_search([4, 8, 15, 16, 23, 42], 4) before running, and (b) explain why:
def binary_search(lst, target):
lo, hi = 0, len(lst) - 1
while lo <= hi:
mid = (lo + hi) // 2
if lst[mid] == target: return mid
elif lst[mid] < target: lo = mid + 1
else: hi = mid - 1
return -1
Part 4 — Find and fix the bug (25 pts). A student runs that binary search on the unsorted list [8, 4, 23, 16, 42, 15] to find 4, and it returns -1 though 4 is present. (a) Explain why, and (b) give a one-line fix.
Integrity & AI note. Your own work, submitted for grading. You may use an approved chatbot to help you think, but submitting AI-generated answers as your own isn't allowed; if AI helped, add a one-line note. Run your code before submitting. (Traditional format; the adaptive version has you work the problems with the chatbot — see I-assignment-and-rubric-week-13.md.)
Rubric — 100 points
| Criterion (part) | Full credit | Partial | Little/none |
|---|---|---|---|
| Part 1 — Linear search (25) | Correct loop, returns the index, -1 when absent, both tests right (25) | Returns True/False or off-by-one (10–18) | Non-working (0–8) |
| Part 2 — Count comparisons (25) | Counter incremented once per item; finding 42 = 6 (25) | Counter off by one (10–18) | Missing (0–8) |
| Part 3 — Predict (25) | Output 0 + correct halving reasoning (25) | Right number, weak reason (10–18) | Wrong (0–8) |
| Part 4 — Find & fix (25) | Names the sorted-precondition reason + sorts first (25) | Right fix, fuzzy reason (10–18) | Neither (0–8) |
(This same rubric is what the adaptive variant embeds for the AI to grade against.)
Instructor answer key — REMOVE BEFORE PUBLISHING TO STUDENTS
Execution gate: PASS — every program and output below was produced by running the code.
- Part 1: a
for i in range(len(lst))loop returningiwhenlst[i]==target, else-1. On[4,8,15,16,23,42]: 16 → 3, 7 → -1 (run-verified). - Part 2: increment
comparisonsonce per iteration; finding 42 returns(5, 6)— 6 comparisons (run-verified); a missing value is also 6. - Part 3: prints 0. mid=2 (15); 15>4 so hi=1; mid=0 (4); 4==4 → return index 0 (run-verified, 2 comparisons).
- Part 4: (a) binary search assumes sorted order to pick which half to keep; on unsorted data it discards the half holding 4 and returns -1 (run-verified). (b) sort first:
binary_search(sorted(data), 4)finds 4 at index 0 — or use linear search.
Canvas placement block
canvas_object = Assignment
title = "Week 13 Assignment — Search, Sort, Count (traditional)"
assignment_group = "Assignments"
points_possible = 100
grading_type = points
assignment_type = traditional
submission_types = [online_upload, online_text_entry]
due_offset_days = 6
published = true
rubric_ref = "week-13-assignment-rubric"
provenance = "~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com"
~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com