Jabz

433 Reputation

5 Badges

15 years, 339 days

MaplePrimes Activity


These are questions asked by Jabz

How do i chek what order my procedure is . For example Bubble Sort is O(n^2) merge sort is O(n log n). I have a procedure but i do not know how to chek the order?

I am trying to code a naive method for checking if a number is prime. where it checks if a number is prime by checking if a number 'k' divdes into n.

 

Hi i am trying to code the Merge sort algorithm in maple but i've reached a point where i can't progress further. Any assistance would be greatly appriciated.

This is what i have done so far

FIRST ATTEMPT:

restart:
with(ListTools):
L := rtable(1..6,random(1..50));
n:=convert(L,'list');
E:=[LengthSplit(n,nops(n)/2)];

for j from 1 to nops(E) do
F:=[LengthSplit(E[j],1)];
d:=[]:
smallest:=op(F[1]):

for i from 1 to nops(F) do
if op(F[i]) < smallest then

Is it some kind of a malware or an advertisement virus of some sort?

Hi merry xmas and a happy new every1.

I am trying to code the cocktail sort algorithm into maple but having some difficulties.

i coded bubble sort but cnt seem to code the cocktail sort any help would be appricited.

 

restart:
l:=[5,4,3,2,1]:
for j from 1 to nops(l)-1 do:
for i from 1 to nops(l)-1 do:
if l[i] > l[i+1] then
d:=l[i]:
l[i]:=l[i+1]:
l[i+1]:=d:
fi:od:od:
print(l);
 

1 2 3 4 5 Page 2 of 5