22C:31 Algorithms
Midterm Exam (100 points)
Closed books and notes (except one sheets of notes)
October 13, 2015
When asking for designing an algorithm, both English description and pseudo-code are
required. When asking for an efficient algorithm, the sco
CS/MCS 401, Summer 2016, Lowman, Midterm (HW7).
due in class Friday, Aug 5.
1. What is the optimal way to compute A1 A2 A3 A4 A5 A6 , where the dimensions of the
matrices are: A1 :10x20, A2 :20x1, A3 :1x40, A4 :40x5, A5 :5x30, A6 :30x15
give the complete
Mcs-Cs 401, Summer 2016, Lowman, Quiz 2 (HW6).
due in class Monday, July 28.
Hash functions
In section 11.3.2 of the textbook page 263-264 the multiplication method
is given by:
h(k) = bm (kA mod 1)c with 0 < A < 1.
(1)
The CLRS slides for hash function
Independent set (graph theory)
From Wikipedia. the free encyclopedia
In graph theory, an Independent set or stable set is a set of vertices
in a graph. no two of which are adjacent. That is, it is a set S of vertices
such that for every two vertices in
Mcs-Cs 401, Summer 2016, Lowman, Quiz 1 (HW5).
due in class Monday, July 18.
1. Solve the following recurrence relation using a recurrence tree. T (n) =
T (n/3) + T (2n/3) + cn2 , T (1) = constant
2. Use integrals to bound Hn , the nth harmonic number, on
CS/MCS 401, Homework 3 ,Lowman, Summer 2016
Due in class Wednesday 7/6/16. Late homework will not be accepted.
Note, no class Monday 7/4/16.
In all problems work must be shown to explain your answers.
1. Use the definition of a binomial
P random variable
CS 342 - 3/3/16
Exam Next Wednesday 3/9/16
Write a C program
- you will have 1hr 50 minutes to submit via blackboard
- you may bring in code, books, notes
Will contain one of the following:
- stack implemented as linked list
- stack implemented as dyn
CS 211 - 3/11/16
/ For the Project create, "MyStack.java" file
public class MyStack / the name of the public class must
/ match the name of the file
cfw_
/ data members of the class (set to private)
private MyNode head;
.
/ methods of the class (set
CS 211 - 10/7/16
Exam 1 - Wednesday, 10/19/16
During lab, you will have to write and submit a C program.
The program will use one of the following:
- a queue implemented as a linked list
- a queue implemented as a dynamic array
- a stack implemente
CS 211 - 10/21/16
Linked Lists in Java
Typically 2 classes are used
one class for the nodes in the list
one class for the list itself
/ must be in the file Node.java
public class Node
=
/ could exist in a file not named Node.java
/ often the Node class
CS 211 - 8/26/16
pass-by-value = copies are send to the function, modifying the copy
does not change the original
pass-by-reference = a reference to the original is sent to the function
modifying the reference does update the original
the "pass-by-re
CS 211 - 9/2/16
int size2 = 50;
int *arr2 = (int*) malloc ( size2 * sizeof(int) );
int i = 0;
while ( MORE INPUT )
cfw_
scanf ( "0", &val);
/* check if the array is full before adding the value */
if ( i >= size2 )
cfw_
/* grow ( &arr2 , &siz
Chapter 26 uverview
Nehmrk Iluw
Uh: third Ddii'ian [man ow network: di'mny From lb: rs! lwo cdilions. The
concept of me! How is gone, axe-cpl that we d5 discuss rm! ow across a cur. Skew
symmcrtyis also galls, asisimphcil summalron noraiium Ti): third Edi
CS 473: Algorithms
Chandra Chekuri
[email protected]
3228 Siebel Center
University of Illinois, Urbana-Champaign
Fall 2008
Chekuri
CS473ug
3-SAT and Independent Set
Sat and 3-SAT
Part I
Reductions Continued
Chekuri
CS473ug
3-SAT and Independent Set
Sat
22C:31 Algorithms
Midterm Exam (100 points)
Closed books and notes (except one sheets of notes)
March 12, 2015
When asking for designing an algorithm, both English description and pseudo-code are
required. When asking for an efficient algorithm, the score
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sorting;
/*
*
* @author Bryan Ehlers
*/
import java.io.BufferedRea
/ Binary search tree nodes and standard methods
public class
public
public
public
public
public
treeNode cfw_
int iData;
int height;
boolean isRed;
treeNode left;
treeNode right;
/
/
/
/
/
data item (key)
height of node
for Red-black tree
this node's left
CS 161
Homework 2
Fall 2015
R-4.2 Consider the insertion of items with the following keys in the given order into an initially
empty wavl tree: 12, 44, 52, 58, 38, 27, 41, 11. Draw the final tree that results.
12
1
12
2
12
44
2
1
2
44
2
52
3
1
3
44
12
52
public class splaytree cfw_
private treeNode Root;
/ Root of the BST
public splaytree() cfw_ Root = Root.nullnode;
tree yet
public void clear() cfw_ Root = Root.nullnode;
/ constructor; no nodes in
public treeNode getRoot() cfw_ return Root;
public boo
public class redblacktree cfw_
private treeNode Root;
public treeNode getRoot() cfw_ return Root;
/ Constructs a new empty red-black tree.
public redblacktree() cfw_ Root = Root.nullnode;
public void clear() cfw_ Root = Root.nullnode;
public boolean isE
Basic quantities
Charge, energy, voltage, current, power
Passive sign convention
Tellegen's Theorem (conservation of power)
Basic elements
Independent sources (voltage, current)
Dependent sources (4 kinds)
Resistors and Ohm's Law
Resistor power
Short circ
public class avltree cfw_
private treeNode Root;
/ first node of tree
public avltree() cfw_ Root = Root.nullnode;
/ constructor; no nodes in
tree yet
public void clear() cfw_ Root = Root.nullnode;
public treeNode getRoot() cfw_ return Root;
public bool
import
import
import
import
java.io.BufferedReader;
java.io.InputStreamReader;
java.util.Random;
java.util.Arrays;
/ Test binary search trees (bst).
public class bst cfw_
private static int N = 20;
/ Test program
public static void test(int [] keys, int [