Write a C++ program to find
for non-negative integer values
of M and N. Remember these are the binomial coefficients or the
number of ways of choosing M items out of a set of N items without
replacement. Your program must use a recursive function to do its
calculations. Use the recurrence relation

Your program should prompt the user for the two integers. If either value is negative or if M > N, the program should print an appropriate error message. Otherwise it should print the correct value.
Your program will be graded on style and readability as well as correct operation. Turn in a listing of your program on 8 1/2 by 11 sheets. Be sure to burst the pages and staple them together if your listing is more than one page long. You are responsible for testing your program and making sure that it works correctly.
For extra credit: in addition to printing the result, have your program print the number of additions performed to get the correct answer.
Do you think that this algorithm is efficient? Do you have any
ideas for making the algorithm more efficient?
![]()
Actually this is not actually a true programming assignment. Instead you will just write the code for a C++ class that will be used in the next programming assignment.
Implement a data structure that maintains integers in a sorted array. This class is described by the header file below. Your job is to implement the member functions for the class sorted_array.
//Header File stdinc.h #include <iostream.h> #include <iomanip.h> #include <fstream.h> #include <stdlib.h> #include <stdio.h> #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif
// Header file for sorted.h
#include "stdinc.h"
#define Max_Items 100
class sorted_array {
int data[Max_Item];
int num_items;
public:
sorted_array( ) {num_items = 0;};
int find(int key, int& position);
int insert(int key);
int delete(int key);
}; // sorted_array
Your programs will be graded on style and readability as well as correct code. Turn in a listing of your programs on 8 1/2 by 11 sheets. Be sure to burst the pages and staple them together if your listing is more than one page long. Of course good style is not enough, your code must also be correct to receive full credit for this assignment