Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,12 @@
"name": "Roman Numerals",
"uuid": "2fc4f834-a51c-42b8-a4d9-5263229e7648",
"practices": [],
"prerequisites": [],
"prerequisites": [
"strings",
"loops",
"numbers",
"conditionals"
],
"difficulty": 3,
"topics": [
"conditionals",
Expand Down Expand Up @@ -2391,7 +2396,10 @@
"name": "Square Root",
"uuid": "31c7725e-def0-4dc9-88a0-e19afb9bfb06",
"practices": [],
"prerequisites": [],
"prerequisites": [
"numbers",
"arithmetic-operators"
],
"difficulty": 4,
"topics": [
"bitwise_operations",
Expand Down Expand Up @@ -2422,7 +2430,12 @@
"name": "All Your Base",
"uuid": "d2d3cd13-b06c-4c24-9964-fb1554f70dd4",
"practices": [],
"prerequisites": [],
"prerequisites": [
"numbers",
"arrays",
"loops",
"arithmetic-operators"
],
"difficulty": 5,
"topics": [
"conditionals",
Expand Down Expand Up @@ -2465,7 +2478,11 @@
"name": "Queen Attack",
"uuid": "007a4cd4-7324-4512-8905-ead0c78146f7",
"practices": [],
"prerequisites": [],
"prerequisites": [
"classes",
"numbers",
"conditionals"
],
"difficulty": 4,
"topics": [
"conditionals",
Expand All @@ -2482,7 +2499,12 @@
"name": "React",
"uuid": "303c6969-9446-41aa-871a-11223a43e810",
"practices": [],
"prerequisites": [],
"prerequisites": [
"classes",
"numbers",
"arrays",
"functions"
],
"difficulty": 8,
"topics": [
"algorithms",
Expand All @@ -2495,7 +2517,13 @@
"name": "Zipper",
"uuid": "fd1575f3-3087-4cfa-8a26-168fba6d0606",
"practices": [],
"prerequisites": [],
"prerequisites": [
"classes",
"recursion",
"trees",
"numbers",
"arrays"
],
"difficulty": 8,
"topics": [
"recursion",
Expand Down
11 changes: 8 additions & 3 deletions exercises/practice/zipper/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

Creating a zipper for a binary tree.

[Zippers][zipper] are a purely functional way of navigating within a data structure and manipulating it.
They essentially contain a data structure and a pointer into that data structure (called the focus).
[Zippers][zipper] are a purely functional way to navigate and manipulate a data structure.
A zipper is not simply a data structure with a pointer - instead, it consists of two parts:

For example given a rose tree (where each node contains a value and a list of child nodes) a zipper might support these operations:
1. **The path/thread**: The steps taken to reach the focused node (e.g., "go left from root", "go right from there")
2. **The focused subtree**: The current node and everything below it

From these two parts, the original data structure can be fully reconstructed, and modifications can be made by building new subtrees as you reverse the path.

For example given a binary tree, a zipper might support these operations:

- `from_tree` (get a zipper out of a rose tree, the focus is on the root node)
- `to_tree` (get the rose tree out of the zipper)
Expand Down