asghar

0 Reputation

2 Badges

13 years, 97 days

MaplePrimes Activity


These are answers submitted by asghar

Okay so I have a procedure here which uses merge on the selectsort proccedure I wrote above. When I am running this, it is supposed to give me the answer as a list. But it doesn't do so since Lsize,SelectSort etc All these procedures were written for vectors where the list L was changed to a vv := Vector(L) How can i display the proper list? I have put up an example to tell how it shows stuff.

 

 

DivideL := proc (L)
local S1, S2, SIZE, L5, K, M;
S1 := L; S2 := L;
SIZE := Lsize(L);
S1 := L[1 .. (1/2)*SIZE];
S2 := L[(1/2)*SIZE+1 .. SIZE];
K := SelectSort(S1);
M := SelectSort(S2);
L5 := Merge(K, M);
return L5 
end proc 

 

M1 := [-5, -3, -1, 0, 1, 2, 3, 6]

> DivideL(M1);
[-5, -3, -1, 0, 4, {(1) = 1, (2) = 2, (3) = 3, (4) = 6}, datatype = anything,

storage = rectangular, order = Fortran_order, shape = []]
Page 1 of 1