70 likes | 149 Views
Learn to load & execute files, create a BST, test len, msort, & more in ML! Implement n!, 2^n & more. Extra: Binary tree in ML!
E N D
CS 360 Lab 2 Instructor: Krzysztof Nowak TA: Mark Boady
Part 1 • Delayed Map • Load file and execute exactly as instructed • View the source code to figure out what happened and answer written question • BST • Make a BST with values 1-7 • How do you insert the values so the height of the tree is 2? • Verify the tree using member
Part 1 (define BST '())(define BST (insert 3 BST))(define BST (insert 1 BST))(define BST (insert 2 BST))(define BST (insert 6 BST)) (member 2 BST)(member 5 BST) ;Value 13: (3 (1 () (2 () ())) (6 () ()))
Part 2 • Similar to last week • Test and write specifications for • len • maxmin • msort • This time in ml • Note: It is called len because length is built in
Part 3 • Implementation of • n! • 2^n • Composition 2^(n!) • Follow link to see how to compose • Only 1 recursive implementation
Part 4 (Extra Credit) • Implement binary tree in ml • Insert and member from Part 1(ii) • Repeat the experiment from Part 1 (ii)