Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Professor David Cash
Homework 9 Solutions
1. (5 points) Fix two distinct numbers a, b, and let X be a random variable such that P (X =
a) = p and P (X = b) = 1 p. Find E(X) and
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Solutions by Abdul Basit
Homework 6 Solutions
1. The parts of this problem are unrelated.
(a) (5 points) We deal a five card hand. Let A be the event that all 5 cards are the sa
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Professor David Cash
Homework 4 Solutions
1. We are going to divide a collection of 20 children into groups. The order of the teams does
not matter (i.e. the teams are unnamed).
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Solutions prepared by Hai Xuan Pham
Homework 7 Solutions
1. (10 points) Suppose we play a modified version of the Monty Hall game. In this version, there
are 5 doors instead ins
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Professor David Cash
Homework 8 Solutions
1. (5 points) We roll two modified six-sided die that have faces 1, 1, 2, 3, 4, 4, all shown with
equal probability. Let X be the face
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Solutions prepared by Hai Xuan Pham
Homework 10 - Solutions
1. For each of the statements below, determine if they are true or false. If it is true, explain
why, using any resul
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Solutions by Hai Xuan Pham
Homework 5 - solutions
Instructions: All problems on this homework are worth 10 points, including the extra credit
question.
1. (10 points) Give a sto
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2015
Professor David Cash
Homework 2 Solutions
1. (25 points) In all parts of this question, ID numbers are 5 digits long (where each digit comes
from 0 through 9).
(a) How many poss
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Professor David Cash
Homework 3 - Solutions
1. To fulfill the requirements for a degree, a student can choose to take any 5 out of 25 courses,
with the constraint that at least
Rutgers University
CS206: Introduction to Discrete Structures II, Spring 2016
Homework 1 Solutions
1. Suppose E, F, G are events in a some sample space S. In class, we learned that, for instance,
E F can be interpreted as E implies F . For each of the rel
package apps;
import java.io.IOException;
import java.util.Scanner;
import structures.Node;
/*
* This class sorts a given list of strings which represent numbers in
* the given radix system. For instance, radix=10 means decimal numbers;
* radix=16 means h
CS 211: Computer Architecture, Spring 2016
Programming Assignment 3: Assembly Language Programming
1
Introduction
This assignment is designed to give you additional practice in reading and writing Assembly Language programs. As discussed in lecture, unles
CS 211: Computer Architecture, Spring 2016
Programming Assignment 2:
Data Representation and Computer Arithmetic
1
Introduction
This assignment is designed to help you learn the representation, interpretation, and manipulation
of data as bits. There are t
CS 211: Computer Architecture, Spring 2016
Programming Assignment 1: A Partial Tokenizer
1
Introduction
In this assignment, you will practice programming with the C language. Much of your code will
come in the form of operating on C strings, although you
4/10/2016
CS112Spring2016:ProblemSet9
Problem Set 9
Hash table
1. WORK OUT THE SOLUTION TO THIS PROBLEM AND TURN IT IN AT RECITATION
You are given the following keys to be hashed into a hash table of size 11:
96,43,72,68,63,28
Assume the following hash fu
4/10/2016
CS112Fall2015ProblemSet8
Problem Set 8
Binary Tree, Huffman Coding
1. * Answer the following questions in terms of h, the height of a binary tree:
1. What is the minimum possible number of nodes in a binary tree of height h?
2. A strictly binary
4/10/2016
CS112Spring2016:ProblemSet7
Problem Set 7
AVL Tree
1. * Each node of a BST can be filled with a height value, which is the height of the subtree rooted
at that node. The height of a node is the maximum of the height of its children, plus one. Th
4/10/2016
CS112Spring2016:ProblemSet10
Problem Set 10
Heap
1. Given the following sequence of integers:
12,19,10,4,23,7,45,8,15
1. Build a heap by inserting the above set, one integer at a time, in the given sequence.
Show the heap after every insertion.
4/10/2016
CS112Spring2016:ProblemSet6Solution
Problem Set 6 Solution
Binary Search Tree (BST)
1. WORK OUT THE SOLUTION TO THIS PROBLEM, AND TURN IT IN AT RECITATION
Given the following sequence of integers:
5,15,35,10,70,25,30,75
1. Starting with an empty
Class Information
Reminder: Second homework due on Friday,
February 14, before class.
CS 314
spring14 lecture 7, page 1
Review: Top-Down Parsing - LL(1)
S
S:=aSb | e
aaabbb
x is epsilon in beginning
and y is rest. then input
a then x is a and y is
rest.
Class Information
Third homework will be posted today; due next
Friday.
Our first programming project will be posted next
week, tentatively Wednesday. Due on Friday, March
7.
Next lecture, Prof. Zheng Zhang
CS 314
spring14 lecture 8, page 1
Review: Rec
Class Information
Midterm exam: Friday, March 14, in class, closed
book, closed notes.
Fifth homework will be posted by tomorrow. Last
homework before the exam.
Will start posting homework sample solutions over
the weekend.
CS 314
spring14 lecture 12,
Class Information
Fourth homework will be due on Friday.
Midterm exam: Friday, March 14, in class, closed
book, closed notes.
CS 314
spring14 lecture 11, page 1
Review: Run-time storage organization
Typical memory layout
Logical Address Space
C
o
d
e
S
Class Information
Last chance to turn in your second homework.
There are some general intermittened networking
problems with the CS web sites. This is not specific
to our 314 web site. If you dont have access, try
later.
The first programming project w
Class Information
Second homework will be posted today or early
tomorrow. Due next Tuesday before class.
CS 314
spring14 lecture 5, page 1
Review: Context Free Grammars (CFGs)
A formalism for describing languages
A CFG G is a quadruple G =< T, N, P, S
Class Information
Second homework due on Friday, February 14, before
class.
CS 314
spring14 lecture 6, page 1
particular parser we want to look at = top-down parser = faster to write by hand.
another one is bottom-up parser. = harder to write and is more