Problem Bank
pdf
keyboard_arrow_up
School
University of British Columbia *
*We aren’t endorsed by this school
Course
110
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
22
Uploaded by HighnessWolverineMaster694
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
1/22
Problem Bank
Problems numbered P1, P2... are practice problems. Problems numbered NV1, NV2... are problems
from the edX numbered videos.
Problems that have an autograder are marked in the first column.
Easy Medium Hard
Problem
Number
Difficulty
Requires
lectures
Name and files
BSL P1
exprs
More Arithmetic Expression
Write more arithmetic expressions.
more-arithmetic-expression-starter.rkt
more-arithmetic-expression-solution.rkt
BSL P2
Has Grader
eval
Primitive Evaluation
Write out the step-by-step evaluation of
expressions involving calls to primitives.
primitive-evaluation-starter.rkt
primitive-evaluation-solution.rkt
BSL P3
strs-imgs
Tile
Create an image using image composition
primitives.
tile-starter.rkt
tile-solution.rkt
BSL P4
strs-imgs
Glue
Write an expression to combine strings
together.
glue-starter.rkt
glue-solution.rkt
BSL P5
bools-if-
exprs
Compare Images
Write expressions to operate on booleans
using primitives.
compare-images-starter.rkt
compare-images-solution.rkt
BSL P6
Has Grader
stepper
Function Call Evaluation
Step by step evaluation of expressions
involving calls to programmer defined
functions.
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
2/22
function-call-evaluation-starter.rkt
function-call-evaluation-solution.rkt
BSL P8
strs-imgs
Canadian Flag Background
Write expression to produce background
image of Canadian flag.
cflag-starter.rkt
cflag-solution.rkt
BSL P9
exprs
Even More Arithmetic Expression
Write even more arithmetic expressions.
even-more-arithmetic-expression-starter.rkt
even-more-arithmetic-expression-solution.rkt
BSL P10
strs-imgs
Triangles
Write an expression that operates on images
using image primitives.
triangle-starter.rkt
triangle-solution.rkt
BSL P12
strs-imgs
Debug Expression
Fix the error(s) in a call to an image primitive.
debug-rectangle-starter.rkt
debug-rectangle-solution.rkt
BSL P13
exprs
Arithmetic Expression
Write an arithmetic expression.
arithmetic-expression-starter.rkt
arithmetic-expression-solution.rkt
BSL P14
strs-imgs
Overlay
Write an expression that operates on images
using image primitives.
overlay-starter.rkt
overlay-solution.rkt
BSL P15
fun-def
Function Writing
Write a function that produces the larger of
two given numbers.
function-writing-starter.rkt
function-writing-solution.rkt
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
3/22
HtDF NV1
yell
Yell
Design a function to yell!
yell-starter.rkt
yell-solution.rkt
HtDF NV2
area
Area
Design a function to calculate the area of a
square.
area-starter.rkt
area-solution.rkt
HtDF NV3
img-area
Image Area
Design a function to calculate the area of an
image.
image-area-starter.rkt
image-area-solution.rkt
HtDF NV4
tall
Tall
Design a function to determine if an image is
tall.
tall-starter.rkt
tall-solution.rkt
HtDF P1
full
Summon
Design a function to summon items.
summon-starter.rkt
summon-solution.rkt
HtDF P2
full
Less Than 5
Design a function to check if length of a string
is less than 5.
less-than-five-starter.rkt
less-than-five-solution.rkt
HtDF P3
full
Boxify
Design a function to put a box around a given
image.
boxify-starter.rkt
boxify-solution.rkt
HtDF P4
full
Pluralize Stubs
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
4/22
Write more than one stub for a function given
its signature and purpose.
pluralize-stubs-starter.rkt
pluralize-stubs-solution.rkt
HtDF P5
full
Blue Triangle
Design a function to produce a blue solid
triangle of a given size.
blue-triangle-starter.rkt
blue-triangle-solution.rkt
HtDF P6
full
Double Error
Fix the error(s) in a function that doubles a
given number.
double-error-starter.rkt
double-error-solution.rkt
HtDF P7
full
Make Box
Design a function to create a square based on
the given colour.
make-box-starter.rkt
make-box-solution.rkt
HtDF P8
full
Ensure Question
Design a function to produce a question by
adding ? to the end of a given string.
ensure-question-starter.rkt
ensure-question-solution.rkt
HtDF P9
full
Cartesian
Design a function to calculate the distance
between two points.
cartesian-starter.rkt
cartesian-solution.rkt
HtDD NV1
atomic
City name
Design a data definition for all the citys in the
world.
city-name-starter.rkt
city-name-solution.rkt
HtDD NV2
atomic-
htdf
Best
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
5/22
Given the data definition for City, design a
function that checks if a given city is the best
city in the world.
best-starter.rkt
best-solution.rkt
HtDD NV3
interv
Seat number
Design a data definition for seat numbers in a
theatre.
seat-num-starter.rkt
seat-num-solution.rkt
HtDD NV4
enum
Letter grade
Design a data definition to represent a
student"s grade.
letter-grade-starter.rkt
letter-grade-solution.rkt
HtDD NV5
itemz
Countdown
Design a data definition to represent the
current state of a New Year"s Eve countdown.
countdown-starter.rkt
countdown-solution.rkt
HtDD NV6
interv-htdf
Aisle
Given the data definition for SeatNum, design
a function that determines if the seat number
is on the aisle.
aisle-starter.rkt
aisle-solution.rkt
HtDD NV7
enum-htdf
Bump up
Given the data definition for LetterGrade,
design a function that produces the next
highest grade.
bump-up-starter.rkt
bump-up-solution.rkt
HtDD NV8
itemz-htdf
Countdown to display
Given the data definition for Countdown,
design a function that produces an image of
the current state.
countdown-to-display-starter.rkt
countdown-to-display-solution.rkt
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
6/22
HtDD P1
interv-htdf
Employees
Design a data definition and a function for a
program to track a ski lodge"s payroll.
employees-starter.rkt
employees-solution.rkt
HtDD P2
enum-htdf
Demolish
Design a data definition and a function for a
program to classify buildings in downtown
Vancouver.
demolish-starter.rkt
demolish-solution.rkt
HtDD P3
itemz-htdf
Rocket
Design a data definition and a function for a
program to track a rocket"s return to Earth.
rocket-starter.rkt
rocket-solution.rkt
HtDD P4
enum
LetterGrade Error
Fix error(s) in the revised data definition for
LetterGrade.
letter-grade-error-starter.rkt
letter-grade-error-solution.rkt
HtDD P5
interv
Style Rules
Discuss the importance of following style rules
and fix a given data definition to follow them.
style-rules-starter.rkt
style-rules-solution.rkt
HtDD P7
itemz-htdf
Rocket Error
Fix the error(s) in a function we have
developed for the Rocket program.
rocket-error-starter.rkt
rocket-error-solution.rkt
HtDD P8
enum-htdf
Direction
Design a function based on a given data
definition for compass directions.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
7/22
direction-starter.rkt
direction-solution.rkt
HtDD P9
enum-htdf
Dinner
Design a data definition to represent airline
dinners, and a function to let flight attendants
know a passenger"s choice.
dinner-starter.rkt
dinner-solution.rkt
HtDW NV1
da, main,
wish-list
Cat
A cat that moves across the screen.
cat-starter.rkt
cat-v3.rkt
HtDW NV2
add-key
Add mouse-handler to cat
Given an existing world program, add a mouse
handler to reset the position of the moving cat.
add-mouse-handler-starter.rkt
cat-v4.rkt
HtDW P1
da, main,
wish-list
Countdown Animation
Design an animation of a countdown.
countdown-animation-starter.rkt
countdown-animation-solution.rkt
HtDW P2
da, main,
wish-list
Traffic Light Animation
Design an animation of a traffic light.
traffic-light-starter.rkt
traffic-light-solution.rkt
Compound
NV3
htdw
Cowabunga
A cow that wanders back and forth across the
screen.
cowabunga-starter.rkt
cowabunga-v0.rkt
cowabunga-v1.rkt
cowabunga-v2.rkt
cowabunga-v3.rkt
cowabunga-v4.rkt
cowabunga-v5.rkt
cowabunga-v6.rkt
Compound P1
dd
Movie
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
8/22
Design a compound data definition to
represent movies, and a function to compare
their release dates.
movie-starter.rkt
movie-solution.rkt
Compound P2
htdw
Spinning
Design a world to represent a growing and
rotating red box.
spinning-starter.rkt
spinning-solution.rkt
Compound P3
dd
Student
Design a compound data definition to
represent students, and a function to monitor
their allergies.
student-starter.rkt
student-solution.rkt
Compound P4
dd
Trip
Design a compound data definition to
represent trips, and a function to compare
their lengths.
trip-starter.rkt
trip-solution.rkt
Compound P5
htdw
Growing Grass
Design a world to represent grass that grows
and is replanted.
growing-grass-starter.rkt
growing-grass-solution.rkt
Compound P6
htdw
Mouse Tracker
Design a world where the mouse position is
displayed at the mouse cursor.
tracker-starter.rkt
tracker-solution.rkt
Compound P7
htdw
Rolling Lambda
Design a world where a lambda rolls back and
forth across the screen.
rolling-lambda-starter.rkt
rolling-lambda-solution.rkt
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
9/22
Compound P8
Has Grader
dd
Compound Evaluation Starter
Step by step evaluation of code involving
compound data.
compound-evaluation-starter.rkt
compound-evaluation-solution.rkt
Compound P9
htdw
Water Balloon
Design an animation of throwing a water
balloon.
water-balloon-starter.rkt
water-balloon-solution.rkt
Self-Ref P1
list-fun
Total String Length
Design a function to calculate the total number
of individual characters in a list of strings.
total-string-length-starter.rkt
total-string-length-solution.rkt
Self-Ref P2
des-w-list
Double All
Design a function to double every number in a
list.
double-all-starter.rkt
double-all-solution.rkt
Self-Ref P3
des-w-list
Boolean List
Design a data definition to represent a list of
booleans, and a function to determine if all
values in a given list are true.
boolean-list-starter.rkt
boolean-list-solution.rkt
Self-Ref P4
list-fun
Yell All
Design a function to add "!" to each string in a
list of strings.
yell-all-starter.rkt
yell-all-solution.rkt
Self-Ref P5
des-w-list
Largest
Design a function to find the largest number in
a list of numbers.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
10/22
largest-starter.rkt
largest-solution.rkt
Self-Ref P6
des-w-list
Image List
Design a data definition to represent a list of
images, and a function to find the sum of
areas from a list of images.
image-list-starter.rkt
image-list-solution.rkt
Ref NV1
part-1-2-3
Tuition
A tuition graphing program and intermediate
solutions.
tuition-graph-starter.rkt
tuition-graph-v1.rkt
tuition-graph-v2.rkt
tuition-graph-v3.rkt
tuition-graph-v4.rkt
tuition-graph-v5.rkt
tuition-graph-v6.rkt
Ref P1
part-3
Alternative Tuition Graph
Design the tuition graph bar chart function
based on an alternative data definition for
School.
alternative-tuition-graph-starter.rkt
alternative-tuition-graph-solution.rkt
Ref P2
part-3
Spinning Bears
Design a world program that has an arbitrary
number of spinning bears.
spinning-bears-starter.rkt
spinning-bears-solution.rkt
Ref P3
part-3
Tuition Graph
Design a function to find the lowest tuition,
and a function to produce a list of school
names.
tuition-graph-c-starter.rkt
tuition-graph-c-solution.rkt
Naturals NV1
nat nums
Naturals
Design functions that operate on the Natural
data definition.
naturals-starter.rkt
naturals-solution.rkt
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
11/22
Naturals NV2
parlor
New numerals
Design functions that does arithmetic
operations on the NATURAL data definition.
new-numerals-starter.rkt
new-numerals-solution.rkt
Naturals P1
nat nums
Sum to n
Design a function that computes the sum of all
natural numbers from zero to n.
sum-to-n-starter.rkt
sum-to-n-solution.rkt
Naturals P2
nat nums
Decreasing Image
Design a function that produces an image of
the numbers from n to zero, side by side.
decreasing-image-starter.rkt
decreasing-image-solution.rkt
Naturals P3
nat nums
Odd from n
Design a function that produces a list of all the
odd numbers from n to zero.
odd-from-n-starter.rkt
odd-from-n-solution.rkt
Naturals P4
nat nums
Concentric Circles
Design a function that produces an image of n
concentric circles of a given colour.
concentric-circles-starter.rkt
concentric-circles-solution.rkt
Helpers NV1
all
Arrange Images
Creating a program to sort a list of images and
lay them out next to each other, as
demonstrated in lecture, with all intermediate
solutions.
arrange-images-starter.rkt
arrange-images-v1.rkt
arrange-images-v2.rkt
arrange-images-v3.rkt
arrange-images-v4.rkt
arrange-images-v5.rkt
arrange-images-v6.rkt
Helpers P1
all
Render Roster
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
12/22
Design a program to render a dodgeball game
roster.
render-roster-starter.rkt
render-roster-solution.rkt
Helpers P2
all
Making Rain Filtered
Design a world program to make it rain where
you want it to. In this version of the program
you should remove drops that have already
fallen off the screen from the world state. Be
sure to use all appropriate helper function
rules. There are a total of 9 functions in our
solution, so this problem takes some time.
making-rain-filtered-starter.rkt
making-rain-filtered-solution.rkt
BSTs NV1
loa
Lookup in List
Creating a program to find an account in a list
of account given its account number.
lookup-in-list-starter.rkt
lookup-in-list-solution.rkt
BSTs NV2
dd
BST Data Definition
Creating a data definition for a Binary Search
Tree.
bst-dd-starter.rkt
bst-dd-solution.rkt
BSTs NV3
lookup
Lookup in BST
Creating a function that searches through a
BST.
lookup-in-bst-starter.rkt
lookup-in-bst-solution.rkt
BSTs NV4
render
Render BST
Creating a function that renders a BST
render-bst-starter.rkt
render-bst-solution.rkt
BSTs P1
lookup
Count Nodes
Design a function to count the number of
nodes in a BST.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
13/22
count-nodes-starter.rkt
count-nodes-solution.rkt
BSTs P2
lookup
Sum Keys
Design a function that sums the keys in a BST.
sum-keys-starter.rkt
sum-keys-solution.rkt
BSTs P3
lookup
Height
Design a function to determine the height of a
BST.
height-starter.rkt
height-solution.rkt
BSTs P4
lookup
Insert
Design a function that inserts a node in the
proper place in a BST.
insert-starter.rkt
insert-solution.rkt
BSTs P5
lookup
Balance Factor
Design functions to determine whether a BST
is balanced.
balance-factor-starter.rkt
balance-factor-solution.rkt
BSTs P6
render
Render BST with Lines
Design a function that renders a BST with
lines.
render-bst-w-lines-starter.rkt
render-bst-w-lines-solution.rkt
Mutual-Ref
NV1
all
File System
An implementation of a file system, as
demonstrated in lecture, with all intermediate
solutions.
fs-starter.rkt
fs-v1.rkt
fs-v2.rkt
fs-v3.rkt
fs-v4.rkt
Mutual-Ref P1
fun-part-2
Image Organizer
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
14/22
Several function design problems for arbitrary-
arity trees.
image-organizer-starter.rkt
image-organizer-solution.rkt
Mutual-Ref P2
fun-part-2
Find Person
Design a function to find a person in a person
tree.
find-person-starter.rkt
find-person-solution.rkt
Mutual-Ref P3
fun-part-2
Harry Potter Family Tree
Represent information about descendant
family trees from Harry Potter and design
functions that operate on them.
hp-family-tree-starter.rkt
hp-family-tree-solution.rkt
2-One-Of P1
Has Grader
code
Concat
Design a function that concatenates two lists.
concat-starter.rkt
concat-solution.rkt
2-One-Of P2
code
Merge
Design a function that merges two sorted lists
into a single sorted list.
merge-starter.rkt
merge-solution.rkt
2-One-Of P3
Has Grader
code
Zip
Design a function that produces a list of the
corresponding elements of the given two lists.
zip-starter.rkt
zip-solution.rkt
2-One-Of P4
Has Grader
code
Pattern Match
Design a function that determines if a
sequence of characters matches a given
pattern.
pattern-match-starter.rkt
pattern-match-solution.rkt
2-One-Of P5
code
Championship Bracket
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
15/22
Has Grader
Represent and operate on information about
USA Ultimate championship bracket.
championship-bracket-starter.rkt
championship-bracket-solution.rkt
Local NV1
encap,
recomp
File System 2
Refactoring of file system developed in
Mutual-Ref.
fs-v4.rkt
fs-v5.rkt
fs-v6.rkt
fs-v7.rkt
Local P2
avoid-
recomp
Faster Render BST with Lines
Improve the performance of a function that
produces a simple rendering of a bst with
lines.
render-bst-w-lines-faster-starter.rkt
render-bst-w-lines-faster-solution.rkt
Local P3
Has Grader
eval
Evaluate local
Step by step evaluation of code including local
expressions.
local-evaluation-starter.rkt
local-evaluation-solution.rkt
Local P4
encap
Encapsulate total area
Encapsulate the total-area function into local.
encapsulate-total-area-starter.rkt
encapsulate-total-area-solution.rkt
Local P5
encap,
avoid-
recomp
Championship Bracket Improved
Improve a function that determines which
team knocked a given team out of the
tournament.
championship-bracket-improved-starter.rkt
championship-bracket-improved-solution.rkt
Abstraction
NV1
from-ex
Parameterization
Introduction to abstracting functions, as
demonstrated in lecture, with intermediate
solutions.
parameterization-starter.rkt
parameterization-v2.rkt
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
16/22
parameterization-v3.rkt
parameterization-solution.rkt
Abstraction
NV2
built-in
Using built ins
Design functions that use built-in abstract list
functions.
using-built-ins-starter.rkt
using-built-ins-solution.rkt
Abstraction
NV3
closures
Closures
Design functions that use built-in abstract list
functions with closure.
closures-starter.rkt
closures-solution.rkt
Abstraction P1
built-in
Wide only
Design a function to produce only wide images
from a list of images.
wide-only-starter.rkt
wide-only-solution.rkt
Abstraction P2
built-in
Photos
Design a function to produce all the favourited
photos in the given album.
photos-starter.rkt
photos-solution.rkt
Abstraction P3
from-ex-3
Abstract sum
Design an abstract function to simplify the
sum-of functions.
abstract-sum-starter.rkt
abstract-sum-solution.rkt
Abstraction P4
from-ex-3
Abstract some
Design an abstract function to simplify the
some functions.
abstract-some-starter.rkt
abstract-some-solution.rkt
Abstraction P5
built-in
Ellipses
Write expressions that uses abstract functions
to produce a list of ellipses and images of
ellipses.
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
17/22
ellipses-starter.rkt
ellipses-solution.rkt
Abstraction P6
built-in
Bag
Design a function to produce the linear
lengths of a list of bags.
bag-starter.rkt
bag-solution.rkt
Abstraction P7
built-in
Sum n
Design a function to produce the sum of the
first n odd numbers.
sum-n-starter.rkt
sum-n-solution.rkt
Abstraction P8
fold
Fold dir
Design an abstract fold function for Dir and
some functions that uses this abstract
function.
fold-dir-starter.rkt
fold-dir-solution.rkt
Abstraction P9
Has Grader
from-ex-3
Accounts
Design abstract functions to simplify given
functions.
accounts-starter.rkt
accounts-solution.rkt
Abstraction
P10
built-in
Weather
Use built-in abstract functions to design a
function that produces the sum total of rainfall
on warm days.
weather-starter.rkt
weather.ss
weather-solution.rkt
Genrec NV1
fractals
Fractals
Design of a few basic fractals, as
demonstrated in lecture, with intermediate
solutions.
fractals-starter.rkt
fractals-v1.rkt
fractals-v2.rkt
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
18/22
Genrec NV2
term-arg
Termination
Design three part termination argument for
generative recursions.
termination-starter.rkt
termination-solution.rkt
Genrec P2
term-arg
Van Koch
Design a function to draw a Van Koch fractal
line. The GEOMETRY of this problem is much
more difficult than the triangle and the carpet.
If you feel confident with cartesian geometry
then this function may not be too difficult. If
you feel less confident then you may find this
problem to be too difficult.
van-koch-starter.rkt
van-koch-solution.rkt
Genrec P3
term-arg
Cantor
Design a world program to create the cantor
set.
cantor-starter.rkt
cantor-solution.rkt
Search NV1
sudoku
Sudoku
Design a program that solves a sudoku board,
as demonstrated in lecture, with intermediate
solutions.
sudoku-starter.rkt
sudoku-v1.rkt
sudoku-v2.rkt
sudoku-v3.rkt
sudoku-v4.rkt
sudoku-solution.rkt
sudoku-constraints.rkt
Search P1
sudoku
2 Way Maze
Design a program that tries to find the path
through a maze.
maze-2w-starter.rkt
maze-2w-v1.rkt
maze-2w-solution.rkt
Search P2
sudoku
Triangle Solitaire
Design a program that solves triangle solitaire
puzzles.
triangle-solitaire-starter.rkt
triangle-solitaire-v2.rkt
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
19/22
triangle-solitaire-v3.rkt
triangle-solitaire-v4.rkt
Search P3
sudoku
N Queens
Design a program that solves the n queens
problem.
nqueens-starter.rkt
nqueens-v1.rkt
nqueens-v2.rkt
nqueens-solution.rkt
Search P4
sudoku
Programming Contest
Design a program to help your team plan what
problems to solve in a programming contest.
programming-contest-starter.rkt
programming-contest-v1.rkt
programming-contest-solution.rkt
Accumulators
P1
context-
preserv-
acc
Drop N
Design a function that drops every nth
element from a list.
dropn-starter.rkt
dropn-solution.rkt
Accumulators
P2
context-
preserv-
acc
Replicate Element
Design a function that replicates elements in a
list.
replicate-elm-starter.rkt
replicate-elm-solution.rkt
Accumulators
P3
context-
preserv-
acc
Strictly Decreasing
Design a function that produces true if
numbers in a list are strictly decreasing.
strictly-decreasing-starter.rkt
strictly-decreasing-solution.rkt
Accumulators
P4
tail-rec
Average
Design a tail-recursive function that produces
the average of numbers in a list.
average-tr-starter.rkt
average-tr-solution.rkt
Accumulators
P5
tail-rec
Product
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
20/22
Design a tail-recursive version of a function
that produces the product of numbers in a list.
product-tr-starter.rkt
product-tr-solution.rkt
Accumulators
P6
tail-rec
Sum N
Design a tail-recursive version of a function
that produces the sum of naturals in [0, n].
sum-n-tr-starter.rkt
sum-n-tr-solution.rkt
Accumulators
P7
tail-rec
Sum Odds
Design a tail-recursive version of a function
that produces the sum of odd numbers in a
list.
sum-odds-tr-starter.rkt
sum-odds-tr-solution.rkt
Accumulators
P8
tail-rec
To list
Design a tail-recursive version of a function
that produces a list of naturals from 1 to n.
to-list-tr-starter.rkt
to-list-tr-solution.rkt
Accumulators
P9
tail-rec
Count Evens and Odds
Design a tail-recursive function that produces
separate counts of odd and even numbers in a
list.
count-odd-even-tr-starter.rkt
count-odd-even-tr-solution.rkt
Accumulators
P10
tail-rec
Reverse
Design a tail-recursive function that produces
a list of the same elements in the opposite
order.
rev-tr-starter.rkt
rev-tr-solution.rkt
Accumulators
P11
worklist-
acc
House Path
Design functions that operate on house paths.
house-path-starter.rkt
house-path-solution.rkt
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
21/22
Accumulators
P12
worklist-
acc
Contains Key
Design a tail-recursive function that
determines whether a binary tree contains a
given key.
contains-key-tr-starter.rkt
contains-key-tr-solution.rkt
Accumulators
P13
Has Grader
worklist-
acc
Arbitrary-Arity Tree TR
Design tail-recursive functions that operate on
arbitrary arity trees. First file is from a
structurally recursive template; second file is
from a tail-recursive template.
arbitrary-arity-tree-tr-starter.rkt
arbitrary-arity-tree-template-tr-starter.rkt
Accumulators
NV1
context-
preserv-
acc
Context Preserving Accumulators
Problems where an accumulator is needed to
preserve information lost in the structural
recursion template.
skip1-starter.rkt
skip1-solution.rkt
skip1-v1.rkt
skipn-starter.rkt
skipn-solution.rkt
skipn-v1.rkt
Accumulators
NV2
tail-rec
Tail Recursion
Using accumulators to make functions tail
recursive.
sum-tr-starter.rkt
sum-tr-solution.rkt
Accumulators
NV3
worklist-
acc
Worklist Accumulators
Making functions operating on an arbitrary-
arity tree tail recursive using context
preserving and worklist accumulators.
same-house-as-parent-v1.rkt
same-house-as-parent-v2.rkt
same-house-as-parent-v3.rkt
same-house-as-parent-v4.rkt
same-house-as-parent-v5.rkt
same-house-as-parent-v6.rkt
same-house-as-parent-v7.rkt
same-house-as-parent-solution.rkt
Graphs P1
graphs-
reachable
All Reachable
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
26/04/2023, 18:22
Problem Bank
https://cs110.students.cs.ubc.ca/bank/
22/22
Design a function that produces rooms
reachable from a given room.
all-reachable-starter.rkt
all-reachable-solution.rkt
Graphs P2
graphs-
reachable
Count Rooms
Design a function that produces the number of
rooms reachable from a given room.
count-rooms-starter.rkt
count-rooms-solution.rkt
Graphs P3
graphs-
reachable
Find Room
Design a function that produces a room with
the given name.
find-room-starter.rkt
find-room-solution.rkt
Graphs P4
graphs-
reachable
Max Exits From
Design a function that produces the room with
the most exits.
max-exits-from-starter.rkt
max-exits-from-solution.rkt
Graphs P5
graphs-
reachable
Max Exits to
Design a function that produces a room to
which the greatest number of other rooms
have exits.
max-exits-to-starter.rkt
max-exits-to-solution.rkt
Graphs NV1
cyclic-
data,
templating,
reachable
Graphs
Walking through the design of a data definition
for representing graphs, and a simple function
that operates on those graphs.
graphs-v1.rkt
graphs-v2.rkt
graphs-v3.rkt
graphs-v4.rkt
graphs-v5.rkt
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Documents
Recommended textbooks for you

Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L

EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks ColeProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT

Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L

EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT