Skip to content

Commit

Permalink
adding the assignments
Browse files Browse the repository at this point in the history
Signed-off-by: ncardozo <[email protected]>
  • Loading branch information
ncardozo committed Oct 27, 2020
1 parent c2cf5e2 commit 107fdcf
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions recursion/assignments.oz
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
%% 1. Write a function to calculate the sum of squares of a list

%% 2. Take the following process and write an equivalent iterative process
fun {Exp X N}
if N == 0 then 1
else X * {Exp X N-1}
end
end


%% 3. Take the following process and write an equivalent iterative process
fun {Title S}
case S of nil then ''''
[] X|nil then ''''
[] X|Y|Xs then
if X == ' ' then {Append {Upper Y} {Title Xs}}
else {Append {Upper X} Y|{Title Xs}}
end
end
end

%% 4. Take the following process and write an equivalent iterative process
fun {Fact N}
if N == 0 then 1
else {Fact N-1} * N
end
end


%% 5. Implement the lookup function in a search tree


%% 6. Implement the insert function in a search tree

%% 7. Implement the delete function in a search tree

0 comments on commit 107fdcf

Please sign in to comment.