CSC 122 Introduction to Data Structures
Exam #1 February 22, 2013
Solutions
QUESTION 1 C+ OUTPUT (6
POINTS)
In the box provided, show the output of the following C+ program.
void homer( )
cfw_
cout < Homer! < endl;
void marge( )
cfw_
cout < Marge? < endl
CSC 122 Data Structures
Practice Problems #1
Solutions
1. What output is produced by the following program?
important, except for line breaks.
#include <iostream>
using namespace std;
void status () cfw_
cout < Status is good. < endl;
void hello () cfw_
CSC 122 Data Structures
Homework Assignment #3 Algorithm Analysis
Due Wednesday, April 23, by the beginning of class
1. Calculate the O( ) value for each of the following expressions:
O( n2 )
(a)
12n2 + 9n + 24
(b)
27n lg n + 46n + 193
(c)
19n3 + 42n4 + 1
CSC 122 Data Structures
Final Exam Fall 2012
Solutions
You are allowed to use two standard-sized pieces of paper for notes for this exam;
other than this, the exam is closed-book, closed-notes, and closed-neighbors. There
are a total of 100 points on this
Use Cases:
Start a new game
1. User clicks on the start button
2. User clicks new game button
3. The cards will shuffle with a new deck
4. The deck deals the cards
5. Wait for user to make a move
Variation #1
1.1 In step 2, user selects to start a new gam
Software Requirements
Specifications
for
Solitaire
Version 1.0
Group 1
1. Introduction
1.1 Purpose
To entertain the user. Also to follow the rules set by standard solitaire.
1.2 Intended Audience
The audience targeted is those who enjoy playing cards and
CSC 122 Data Structures
Practice Problems #1
1. What output is produced by the following program? Spacing is not important,
except for line breaks.
#include <iostream>
using namespace std;
void status () cfw_
cout < Status is good. < endl;
void hello ()
CSC 122 Introduction to Data Structures
Practice Exam #2 Solutions
1. Write a C+ function named sumUp that takes one parameter, an integer n. You can assume
that n is positive (1 or more). The function should return the sum of all the values from 1 to
n.
CSC 122 Introduction to Data Structures
Practice Exam #3
Solutions
1. Write a C+ function named sumUp that takes one parameter, an integer n. You can assume
that n is positive (1 or more). The function should return the sum of all the values from 1 to
n.
CSC 122 Introduction to Data Structures
Exam #1 February 22, 2013
For this exam, you can use one sheet of notes (front and back). Other than
that, this exam is closed-book, closed-notes, and closed-neighbor. Write all
your answers on this exam sheet (you
CSC 122 Data Structures
Homework Assignment #3 Algorithm Analysis
Solutions
1. Calculate the O( ) value for each of the following expressions:
12n2 + 9n + 24
(a)
O( n2 )
(b)
27n lg n + 46n + 193
O( n lg n )
19n3 + 42n4 + 12n
(c)
O( n4 )
16n3 + 2n + 99n
(d
CSC 122 Introduction to Data Structures
Practice Exam #3
This exam is actually a compilation of questions from previous semesters
of this class. This exam is not meant to illustrate what a complete exam
would look like, but the individual questions are re
import java.util.ArrayList;
/*
* A class used for practicing ArrayLists
*
* @author Queen
* @version November 2010
*/
public class ArrayListPractice
cfw_
private ArrayList <Book> library;
/*
* Constructor for objects of class ArrayListPractice
*/
public A
CSC 122 Data Structures
Homework Assignment #4 Binary Search Trees
Due Monday, May 5, at the beginning of class
1. Show the tree that would result from inserting a 15 into this tree.
Value = 15
2. Show the tree that would result from removing the 50 from