- Binary Search Trees Variant: We consider a variant of binary search trees in which $left(n) ≤ n < right(n)$ and this for any node $n$ of the tree. Given two binary search trees $A$ and $B$, we are interested in removing from the tree $B$ all the elements that are common to ...
- Sorting an array using two stacks: We want to sort an array of $N$ integers in decreasing order using a stack. To do this, you should use two stacks: a current stack ($\texttt{$S_1$}$) and an auxiliary stack ($\texttt{$S_2$}$) that will be used temporarily for eventual pops. Write a...
- Minimum and maximum values of an array using recursive function: Write a recursive function that returns the minimumand the maximum values of an array of integers.Write a main function to test your program....
- Distinct elements in an array: Let X be an array containing n positive integers. Write a program that creates: An array Dist containing the distinct elements of X An array Effec containing the number of occurrence of each distinct element of X An integer k containing the number o...
- The missing value: We have an array $T[N]$ containing all integers in the interval $0 \cdots N$, except one integer. We want to determine which integer is missing from $T$ using multiple approaches. Example: for the following array $T$ of size $N=6$, the missing valu...
- Sum of the first and the last digits of a number: Write a C program that asks the user to enter an integer number greater than 9, then calculates the sum of the first and the last digits of the number. Running example:Input a number greater than 9: -12Input a number greater than 9: 925Sum of the fir...
- ADT for a point: Provide an ADT specification for a point in a two dimensional space. By definition, to create such a point, you need to provide two coordinates. Supplement your ADT with adequately chosen query functions....
- ADT for a robot: We aim to define a \(\texttt{Robot}\) ADT moving in a two dimensional space with functions allowing to: Create a robot from a position \((x, y)\) and a direction (\(\texttt{North}\), \(\texttt{South}\), \(\texttt{East}\), \(\texttt{West}\)) that beco...
- ADT for a set of n elements: Write an ADT specification for a set of n elements. Operations include (create set, add an element to a set, delete an element from a set, check whether an element is in a set, union of 2 sets, intersection of 2 sets, cardinality of a set, complement...
- ADT for Boolean type: Provide an ADT specification for \(\texttt{Boolean}\) type. By definition, a Boolean is either \(\texttt{true}\) or \(\texttt{false}\). The negation (\(\texttt{Not}\)) of a Boolean is also a Boolean. The \(\texttt{and}\) and \(\texttt{or}\) between t...