which data structure to use to sort n numbers in dr scheme i m not allowed to use vector and structure ..if i use list i cant edit the list values .so how can i sort n numbers . the language i use is textual mzscheme rsr5
is there a way to sort using lists or other data structures rather than using vectors and structures
Arunachalam
2009-10-09 06:46:35
Like this one: http://www.engin.umd.umich.edu/CIS/course.des/cis400/scheme/sorts.html ?? I think you should specify exactly what you're looking for - it's not very clear so far!
Eli Bendersky
2009-10-10 07:30:12
+3
A:
If you cannot edit the list values ... return a new list! :-)
Simon Groenewolt
2009-10-09 06:39:18
A:
Not sure if you are supposed to be writing your own bubblesort for homework, but otherwise this is built in:
(sort (list 1 2 4 3) <) (1 2 3 4)
Ben
2009-10-09 07:11:55
Actually, sort is *not* built in to R5RS Scheme. (http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-15.html#%_index_start). Bubble sort is also a bad choice for Scheme; it is very hard to write compared to insertion sort, for example.
Nathan Sanders
2009-10-10 01:49:17
Hi Nathan - thanks didn't know that was not in the standard. Just started to learn scheme.
Ben
2009-10-11 16:35:27