Lecture14-5

# Lecture14-5 - DataStructures CSCI 132 Spring 2012 Lecture...

This preview shows pages 1–5. Sign up to view the full content.

1 Data Structures   CSCI 132, Spring 2012 Lecture 14 Review for Exam 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Problem 1. Write a function that counts how many even numbers there are in an integer linked list. The function should have one parameter, a pointer to a linked list. The function should not alter the list. It should return an integer value equal to the number of even numbers in the list. You can assume the following definition: struct Node { int data; Node *next; Node(); Node(Node_entry item, Node *add_on = NULL); }
3 Problem 2. 2) Consider the following code: int *y; int *x; x = new int; *x = 15; *x += 2; y = x; *y *= 2; a) Draw a diagram to represent the pointers as each line of this code is executed. b) What are the values of *x and *y after executing this code?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problem 3. What is the output of the following Code? typedef int Stack_entry; typedef int Queue_entry; int main(void) { Stack pile; Queue lineUp; int number; for (int i = 0; i < 5; i++ ) { pile.push(i * 2); lineUp.append(i + 2); } while (!pile.empty()) {
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

Lecture14-5 - DataStructures CSCI 132 Spring 2012 Lecture...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online