2019/6/11 Assignment 10
v.6.10
Assignment 10
Programming Language ISL+Lambda
Due Date Friday 6/14 at 10:00pm
Purpose To work with graphs, to use generative recursion to solve complex problems. Graded Exercises
(define-struct graph [nodes neighbors])
; A Graph is a (make-graph [List-of Symbol] [Symbol -> [List-of Symbol]]) ; and represents the nodes and edges in a graph
Exercise 1 Design the function neighbors? that determines if two given symbols are both neighbors of each other in a graph. You may assume the symbols are in the graph.
Exercise 2 Design the function mutual-neighbors that takes two symbols and a graph and returns a list of neighbors they both have. You may assume the symbols are in the graph.
The following function uses generative recursion. In generative recursive code, termination is no longer obvious. Above functions that use generative recursion, write a termination statement below the purpose statement. A termination statement is a comment that begins with Termination: and then briefly (1-2 sentences) explains why this function terminates.
Exercise 3 Design the function slice which takes a list and a positive integer i and slices the list into segments of length i (with the last one possibly being shorter). For example, (slice (a b c d e) 2) should return ((a b) (c d) (e)). Solve this problem with generative recursion.
https://course.ccs.neu.edu/cs2500/ps10.html 1/1
Programming
[SOLVED] html graph 2019/6/11 Assignment 10
$25
File Name: html_graph_2019/6/11_Assignment_10.zip
File Size: 320.28 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.