Write a function isaset which takes a list of any equality type2 and returns true if the list is a set (each element appears exactly once). So, the type of isaset is ' 'a list -> bool.

Hints:
• Do not try for efficiency. A brute-force O(n2 ) solution is appropriate to this exercise. 3
• You might find it easier to develop an algorithm if you consider how to determine the list is not a set.
• A recursive helper function is needed; again, hide it inside let … in … end;
• isaset is recursive.
• Use appropriate pattern matching in your parameters.
• Trying hard, I found a use for defining a val inside the let … in … end;, but it was a bit contrived; don’t worry if your solution doesn’t have one.
-fun notfound(x,[])=true
| notfound(x,b::y)
if x=b then false
else notfound(x,y);
val notfound = fn : ' ' a* ' ' a list ->bool
-fun isaset [ ]=true
| isaset (c::y)=
if notfound (c,y) then isaset(c::y)
else false;
val isaset =fn : ' ' a list -> bool
Write a function isaset which takes a list of any equality type2 and returns true if...
Write a function isaset which takes a list of
any equality type2 and returns true if the list is a set
(each element appears exactly once). So, the type of isaset is ' 'a
list -> bool.
Hints:
• Do not try for efficiency. A brute-force O(n2 ) solution is
appropriate to this exercise. 3
• You might find it easier to develop an algorithm if you
consider how to determine the list is not a set.
• A recursive...
Write a ML language function stripmin of type
int list -> int list that will return a list from which every
instance of the lowest value has been removed.
Hints:
• Only stripmin itself should be visible at the top level;
•You should have two recursive helper functions tucked away
inside a let … in … end; structure
• Also include a val to avoid having to pass a value that never
changes to one of these functions.
• Use...
Problem 1. Write a Python function times_i_at_odd(L) that takes as arguments a list L and returns a list consisting of the elements of L multiplied by the index number of the element at odd positions. (Use list comprehensions) >>> times_i_at_odd([1,2,3,4,5,6,7,8,9,10]) [2, 12, 30, 56, 90] Problem 2. Write a recursive function sum_cols(grid, n) that takes a list of lists of integers grid and integer n and returns the sum of column n in grid. For example, the call sum_cols([[1,2,3,4], [10,20,30,40],...
1.Write a function called high_point that takes a list of integers and returns True if there exists a value in the list that is bigger than the values immediately before and after it in the list. Your function must return False if no such value exists. The values in the beginning and the end of the list cannot be high points. (20 points) Test Cases: print(high_point([2,5,8,9,7,9])) True print(high_point([2,5,6,6,3])) False print(high_point([2,5,8,21,22])) False 2. Write a while loop to repeatedly ask for...
**HELP** Write a function that takes a linked list of items and deletes all repetitions from the list. In your implementation, assume that items can be compared for equality using ==, that you used in the lab. The prototype may look like: void delete_repetitions(LinkedList& list); ** Node.h ** #ifndef Node_h #define Node_h class Node { public: // TYPEDEF typedef double value_type; // CONSTRUCTOR Node(const value_type& init_data = value_type( ), Node* init_link = NULL) { data_field = init_data; link_field = init_link;...
IntList Recursion Assignment Specifications: You will add some additional recursive functions to your IntList class as well as make sure the Big 3 are defined. IntNode class I am providing the IntNode class you are required to use. Place this class definition within the IntList.h file exactly as is. Make sure you place it above the definition of your IntList class. Notice that you will not code an implementation file for the IntNode class. The IntNode constructor has been defined...
How to write the insert, search, and remove functions for this hash table program? I'm stuck... This program is written in C++ Hash Tables Hash Table Header File Copy and paste the following code into a header file named HashTable.h Please do not alter this file in any way or you may not receive credit for this lab For this lab, you will implement each of the hash table functions whose prototypes are in HashTable.h. Write these functions in a...
Can you please write the two C++ modules below is a step by step instuctions to follow that will make it very easy thanks. Create a module called pqueue.cpp that implements priority queues, with a header file calledpqueue.hthat describes what pqueue.cpp exports. The interface includes the following, and nothing else. Types ItemType and PriorityType are discussed below under the refinement plan. A type, PriorityQueue. Creating a PriorityQueue object with line PriorityQueue q; makes q be an initially empty priority queue....
Can you please write the two C++ modules below is a step by step instuctions to follow that will make it very easy thanks. Create a module called pqueue.cpp that implements priority queues, with a header file calledpqueue.hthat describes what pqueue.cpp exports. The interface includes the following, and nothing else. Types ItemType and PriorityType are discussed below under the refinement plan. A type, PriorityQueue. Creating a PriorityQueue object with line PriorityQueue q; makes q be an initially empty priority queue....