From the course: Coding Exercises: Scala
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Evaluate a decision tree - Scala Tutorial
From the course: Coding Exercises: Scala
Evaluate a decision tree
(computer whirling) (computer chiming) (computer whirling) - [Instructor] Decision trees are a useful way to systematize decisions. In this challenge, we're going to give you a decision tree, and we want you to evaluate it, which means to find the decision it would make, given input. To keep them simple, our decision trees make choices based on a single number and give only true or false output. The trees have two branches. The left branch is for input less than or equal to a given number, and the right branch is for input that's greater. Your job is to implement the decide method, which is given on the code we provided. Now pause the video and come back when you've completed the challenge to see how I did it. (computer whirling) (videogame music) (computer chiming) (computer whirling) So as usual, I'm starting with the skeleton we provided to you, which has a decide method here, and the definition of the decision…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Palindrome detector2m 15s
-
(Locked)
Password checker4m 20s
-
(Locked)
Colored boxes2m 15s
-
(Locked)
System properties1m 17s
-
(Locked)
Resistor tolerance2m 36s
-
(Locked)
Snakes and camels1m 58s
-
(Locked)
Stuff the stats sheet5m 50s
-
(Locked)
A slice of Pi5m 13s
-
(Locked)
Cron and regular expressions4m 35s
-
(Locked)
Reservoir sampling4m 55s
-
(Locked)
Evaluate a decision tree3m 3s
-
(Locked)
Calculator2m 41s
-
(Locked)
Error handling2m 58s
-
(Locked)
Sierpinski Triangle2m 2s
-
(Locked)
Rocketship7m 16s
-