You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specs/source_lists.tex
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -14,74 +14,74 @@ \subsection*{List Support}
14
14
\item\lstinline{is_list(x)}: \textit{primitive}, returns \lstinline{true} if
15
15
\lstinline{x} is a list as defined in the lectures, and
16
16
\lstinline{false} otherwise. Iterative process;
17
-
time: $Θ(n)$, space: $Θ(1)$, where $n$ is the length of the
17
+
time: $\Theta(n)$, space: $\Theta(1)$, where $n$ is the length of the
18
18
chain of \lstinline{tail} operations that can be applied to \lstinline{x}.
19
19
\item\lstinline{list(x1, x2,..., xn)}: \textit{primitive}, returns a list with $n$ elements. The
20
20
first element is \lstinline{x1}, the second \lstinline{x2}, etc. Iterative
21
-
process; time: $Θ(n)$, space: $Θ(n)$, since the constructed list data structure
21
+
process; time: $\Theta(n)$, space: $\Theta(n)$, since the constructed list data structure
22
22
consists of $n$ pairs, each of which takes up a constant amount of space.
23
23
\item\lstinline{draw_data(x1, x2,..., xn)}: \textit{primitive}, visualizes each \lstinline{x1, x2,..., xn} in a separate drawing
24
24
area in the Source Academy using a box-and-pointer diagram; time, space:
25
-
$Θ(n)$, where $n$ is the combined number of data structures such as
25
+
$\Theta(n)$, where $n$ is the combined number of data structures such as
26
26
pairs in \lstinline{x1, x2,..., xn}.
27
27
\item\lstinline{equal(x1, x2)}: Returns \lstinline{true} if both
28
28
have the same structure with respect to \lstinline{pair},
29
29
and the same numbers, boolean values, functions or empty list
30
30
at corresponding leave positions (places that are not themselves pairs),
31
31
and \lstinline{false} otherwise; time, space:
32
-
$Θ(n)$, where $n$ is the number of data structures such as pairs
32
+
$\Theta(n)$, where $n$ is the number of data structures such as pairs
33
33
in \lstinline{x1} and \lstinline{x2}.
34
34
\item\lstinline{length(xs)}: Returns the length of the list
35
35
\lstinline{xs}.
36
-
Iterative process; time: $Θ(n)$, space: $Θ(1)$, where $n$ is the length of \lstinline{xs}.
36
+
Iterative process; time: $\Theta(n)$, space: $\Theta(1)$, where $n$ is the length of \lstinline{xs}.
37
37
\item\lstinline{map(f, xs)}: Returns a list that results from list
38
38
\lstinline{xs} by element-wise application of \lstinline{f}.
39
-
Iterative process; time: $Θ(n)$ (apart from \lstinline{f}), space: $Θ(n)$ (apart from \lstinline{f}), where $n$ is the length of \lstinline{xs}.
39
+
Iterative process; time: $\Theta(n)$ (apart from \lstinline{f}), space: $\Theta(n)$ (apart from \lstinline{f}), where $n$ is the length of \lstinline{xs}.
40
40
\item\lstinline{build_list(f, n)}: Makes a list with \lstinline{n}
41
41
elements by applying the unary function \lstinline{f} to the numbers 0 to \lstinline{n - 1}.
42
-
Iterative process; time: $Θ(n)$ (apart from \lstinline{f}), space: $Θ(n)$ (apart from \lstinline{f}).
42
+
Iterative process; time: $\Theta(n)$ (apart from \lstinline{f}), space: $\Theta(n)$ (apart from \lstinline{f}).
43
43
\item\lstinline{for_each(f, xs)}: Applies \lstinline{f} to every
44
44
element of the list \lstinline{xs}, and then returns
45
45
\lstinline{true}.
46
-
Iterative process; time: $Θ(n)$ (apart from \lstinline{f}), space: $Θ(1)$ (apart from \lstinline{f}), where $n$ is the length of \lstinline{xs}.
46
+
Iterative process; time: $\Theta(n)$ (apart from \lstinline{f}), space: $\Theta(1)$ (apart from \lstinline{f}), where $n$ is the length of \lstinline{xs}.
47
47
\item\lstinline{list_to_string(xs)}: Returns a string that represents
48
48
list \lstinline{xs} using the text-based box-and-pointer notation \lstinline{[...]}.
49
49
\item\lstinline{reverse(xs)}: Returns list \lstinline{xs} in reverse
50
-
order. Iterative process; time: $Θ(n)$, space: $Θ(n)$, where $n$ is the length of \lstinline{xs}.
51
-
The process is iterative, but consumes space $Θ(n)$ because of the result list.
50
+
order. Iterative process; time: $\Theta(n)$, space: $\Theta(n)$, where $n$ is the length of \lstinline{xs}.
51
+
The process is iterative, but consumes space $\Theta(n)$ because of the result list.
52
52
\item\lstinline{append(xs, ys)}: Returns a list that results from
53
53
appending the list \lstinline{ys} to the list \lstinline{xs}.
54
-
Iterative process; time: $Θ(n)$, space: $Θ(n)$, where $n$ is the length of \lstinline{xs}.
54
+
Iterative process; time: $\Theta(n)$, space: $\Theta(n)$, where $n$ is the length of \lstinline{xs}.
55
55
\item\lstinline{member(x, xs)}: Returns first postfix sublist
56
56
whose head is identical to
57
57
\lstinline{x} (\lstinline{===}); returns \lstinline{[]} if the
58
58
element does not occur in the list.
59
-
Iterative process; time: $Θ(n)$, space: $Θ(1)$, where $n$ is the length of \lstinline{xs}.
59
+
Iterative process; time: $\Theta(n)$, space: $\Theta(1)$, where $n$ is the length of \lstinline{xs}.
60
60
\item\lstinline{remove(x, xs)}: Returns a list that results from
61
61
\lstinline{xs} by removing the first item from \lstinline{xs} that
62
62
is identical (\lstinline{===}) to \lstinline{x}. Iterative process;
63
-
time: $Θ(n)$, space: $Θ(n)$, where $n$ is the length of \lstinline{xs}.
63
+
time: $\Theta(n)$, space: $\Theta(n)$, where $n$ is the length of \lstinline{xs}.
64
64
\item\lstinline{remove_all(x, xs)}: Returns a list that results from
65
65
\lstinline{xs} by removing all items from \lstinline{xs} that
66
66
are identical (\lstinline{===}) to \lstinline{x}.
67
67
Iterative process;
68
-
time: $Θ(n)$, space: $Θ(n)$, where $n$ is the length of \lstinline{xs}.
68
+
time: $\Theta(n)$, space: $\Theta(n)$, where $n$ is the length of \lstinline{xs}.
69
69
\item\lstinline{filter(pred, xs)}: Returns a list that contains
70
70
only those elements for which the one-argument function
71
71
\lstinline{pred}
72
72
returns \lstinline{true}.
73
73
Iterative process;
74
-
time: $Θ(n)$ (apart from \lstinline{pred}), space: $Θ(n)$ (apart from \lstinline{pred}), where $n$ is the length of \lstinline{xs}.
74
+
time: $\Theta(n)$ (apart from \lstinline{pred}), space: $\Theta(n)$ (apart from \lstinline{pred}), where $n$ is the length of \lstinline{xs}.
75
75
\item\lstinline{enum_list(start, end)}: Returns a list that enumerates
76
76
numbers starting from \lstinline{start} using a step size of 1, until
77
77
the number exceeds (\lstinline{>}) \lstinline{end}.
78
78
Iterative process;
79
-
time: $Θ(n)$, space: $Θ(n)$, where $n$ is \lstinline{end} $-$ \lstinline{start}.
79
+
time: $\Theta(n)$, space: $\Theta(n)$, where $n$ is \lstinline{end} $-$ \lstinline{start}.
80
80
\item\lstinline{list_ref(xs, n)}: Returns the element
81
81
of list \lstinline{xs} at position \lstinline{n},
82
82
where the first element has index 0.
83
83
Iterative process;
84
-
time: $Θ(n)$ (apart from \lstinline{f}), space: $Θ(1)$ (apart from \lstinline{f}), where $n$ is the length of \lstinline{xs}.
84
+
time: $\Theta(n)$ (apart from \lstinline{f}), space: $\Theta(1)$ (apart from \lstinline{f}), where $n$ is the length of \lstinline{xs}.
0 commit comments