Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data Structures in C++ Implement all of the functions in this assignment recursively. If I see just one loop or unauthorized standard algorithm, youll get

Data Structures in C++

Implement all of the functions in this assignment recursively. If I see just one loop or unauthorized standard algorithm, youll get no credit.

Implement the function that computes the sum of all even numbers less than or equal to n:

int sum_evens(unsigned int n); 

Recursively implement multiplication of two unsigned ints, a and b, using only addition. If you use *, you get no credit. Assume that a >= 0. (Hint: think about multiplication as repeated addition.)

int multiply(unsigned int a, unsigned int b); 

(5) Implement a function to find the smallest element in an array of int:

int smallest(int* arr, int length); 

(6) Implement a function that tests whether a string is a palindrome (reads the same backwards and forwards).

bool is_palindrome(string s); 

(7) Implement a function that determines whether a given int is an element of an array of int:

bool is_element_of(int i, int* array, int length); 

(8) Using your function in (7), implement a function which determines whether one array is a subset of another (that is, whether every element in array a is also an element of array b):

bool is_subset(int* a, int length_a, int* b, int length_b); 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago