You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

933 B

edit_distance

Instructions

Create a function called edit_distance which calculates the minimum number of changes (insertions, deletions and/or substitutions) which need to be made to a string source to transform to another string target.

Expected Function

pub fn edit_distance(source: &str, target: &str) -> usize {
}

Notions

For more information and examples go to this link

Usage

Here is a program to test your function.

use edit_distance::*;

fn main() {
	let source = "alignment";
	let target = "assignment";
	println!(
		"It's necessary to make {} change(s) to {}, to get {}",
		edit_distance(source, target),
		source,
		target
	);
}

And its output:

student@ubuntu:~/edit_distance/test$ cargo run
It's necessary to make 2 change(s) to alignment, to get assignment
student@ubuntu:~/edit_distance/test$