Skip to content

Commit f9e6dae

Browse files
erikrwcartermp
authored andcommitted
Fix Binary Search Tree insert function (#1167)
1 parent 46061ef commit f9e6dae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/snippets/fsharp/tour.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,8 @@ module UnionTypes =
479479
| Empty -> Node(item, Empty, Empty)
480480
| Node(x, left, right) as node ->
481481
if item = x then node // No need to insert, it already exists; return the node.
482-
elif item < x then Node(item, insert x left, right) // Call into left subtree.
483-
else Node(item, left, insert x right) // Call into right subtree.
482+
elif item < x then Node(x, insert item left, right) // Call into left subtree.
483+
else Node(x, left, insert item right) // Call into right subtree.
484484

485485
// ---------------------------------------------------------------
486486
// Option types

0 commit comments

Comments
 (0)