Professional Documents
Culture Documents
Paradigms of Programming
Assignment
Abstract
The motive was to show that all what we have done in C or C++ can be done in haskell
too. So all of the programs I implemented were either taken from a programming contest
or were given to me during our programming lab sessions (which were in C or Java). Also
all the modules are user interactive to show that they are no different from the normal c
programs.
To find the all the primes between any two positive numbers.
Motive :
To show how compact coding can be in haskell. This also shows how easily
prints the primes numbers between them. I implemented this using sieve of
eratosthenes. Here I used Infinite lists, recursion and guarded functions.
that for any two numbers in the permutation there does not exist their mean between
them.
Motive :
the permutation between from 1 to n with the property specified above. I implemented
this using recursion and divide and conquer programming methods. Here I used higher
order functions, recursion, guarded functions and lambda functions.
multiplication of the arrays using dynamic programming. The cost is number of the
multiplications done during the multiplication of the matrices.
Motive :
These list represents the dimensions of the matrices and gives out the minimum cost of
multiplication. I implemented this using recursion and dynamic programming methods
using arrays. Here I used higher order functions, recursion, guarded functions and
Arrays.
Given a list of integers, convert this list and make three types of trees left
skewed, right skewed and balanced. Also find the height of the each tree.
Motive :
binary trees which are - totally left skewed, totally right skewed and balanced. It also
prints the height of the tree made. Here I used recursion, guarded functions and Data
types.
Given a binary tree find whether it is a binary search tree or not. Also find
the size of the maximum sized subtree that is a binary search tree.
Motive :
binary trees which are - totally left skewed, totally right skewed and balanced. It checks
whether the binary tree made is a binary search tree or not and then it prints the size of
the maximum sized subtree that is a binary search tree. Here I used recursion, guarded
functions and Data types.
Given a word find whether it is a left hand, right hand or alternate hand
word.
Motive :
According to the choice the program checks whether the word belongs to a specific type
or not. Word can be of types left - written by only left hand, right - written by right hand
only or is an alternate hand word. Here I used recursion, guarded functions and several
IO functions.