1(10 points)
Given the function:
int see(int k, int A[], int lower, int upper){
// precondition: lower and upper are valid indexes in A
// postcondition:
cout << lower << " " << upper << endl;
if ((upper - lower) < 0) return -1;
int N = (lower + upper)/2;
if (A[N] == k) return N;
if (A[N] > k) return see(k, A, lower, N - 1);
return see(k, A, N + 1, upper);
}
int A[10] = {9, 11, 14, 23, 34, 39, 42, 61, 75, 88};
cout << see(34, A, 0, 9) << endl;
cout << see(75, A, 0, 9) << endl;
cout << see( 6, A, 0, 9) << endl;
cout << see(25, A, 0, 9) << endl;
b.
Write the postcondition for the function
3 (5 points)

2 (5 points)
Turning angle: 90
S -> F+F
F -> F+F-
Show the string and corresponding drawing for levels 1 and 2.
Don't worry about the orientation.
void makeLL(Node* & head, Node* & tail){
long L = 0;
Node* extra;
while (ReadingLong("enter int: ",L)){
extra = new Node;
extra->data = L;
if (L % 2) {
extra->next = head;
head = extra;
if (!tail) tail = head;
}
else
{
extra->next = Null;
tail->next = extra;
tail = extra;
if (!head) head = tail;
};
};
};
Make a NEAT drawing of the linked list that is created by the following code:Node* head = Null; Node* tail = Null; makeLL(head, tail);if the user interaction is as follows:
enter int: 3 enter int: 5 enter int: 6 enter int: 4 enter int: 7 enter int: // return was pressed here
Last Updated: May 11, 1997 11:11 am by