Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Endcons

Function: endcons (<expr>, <list>) Returns a new list consisting of the elements of list followed by <expr>. endcons also works on general expressions, e.g. endcons(x, f(a,b,c)); -> f(a,b,c,x).

merge(a, b) := block(   [c: [ ], i: 1, j: 1, p: length(a), q: length(b)],   while i <= p and j <= q do (      if a[i] < b[j] then (         c: endcons(a[i], c),         i: i + 1      ) else (         c: endcons(b[j], c),         j: j + 1      )   ),   if i > p then append(c, rest(b, j - 1)) else append(c, rest(a, i - 1)));
 mergesort(u) := block(   [n: length(u), k, a, b],   if n <= 1 then u else (      a: rest(u, k: quotient(n, 2)),      b: rest(u, k - n),      merge(mergesort(a), mergesort(b))   ));
mergesort(makelist(k,k,1,1))

(%o1)                                true
(%i2) 

Related Examples

endcons

endcons (0,[1]);

Calculate

endcons

endcons (1,[]);

Calculate

endcons

c: makelist[pon,uto,p...

d: endcons([sri,cet,n...

Calculate

endcons

endcons (0,[1]);

Calculate

endcons

endcons (1,[]);

Calculate

endcons

c: makelist[pon,uto,p...

d: endcons([sri,cet,n...

Calculate