Introduction to Data Structures - Lecture Notes | COMP SCI 367, Study notes of Data Structures and Algorithms

W3(b) Lecture Notes (Skrentny) Material Type: Notes; Class: Introduction to Data Structures; Subject: COMPUTER SCIENCES; University: University of Wisconsin - Madison; Term: Spring 2014;

Typology: Study notes

2013/2014

Uploaded on 03/11/2014

kmfischer3
kmfischer3 🇺🇸

12 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Copyright 2014 Jim Skrentny CS 367 L6 - 1
CS 367 Announcements
Thursday, February 6, 2014
Homework h1 due 10 pm tomorrow, February 7th
Homework h2 assigned tomorrow
Program p1 due 10 pm Sunday, February 16th
Handin directories have been created.
Assignment questions? Post on Piazza or see a TA during lab consulting hours.
Last Time
Exceptions
throwing
handling
execution
practice with exception handling
Today
Exceptions
throws and checked vs. unchecked
defining
Primitive vs. Reference Types
assignment
parameter passing
ADTs vs. Data Structures
Command Line Java Development
Submitting Work
Next Time
Chains of Linked Nodes
Listnode class
practice using
<< code posted on syllabus
pf3
pf4
pf5

Partial preview of the text

Download Introduction to Data Structures - Lecture Notes | COMP SCI 367 and more Study notes Data Structures and Algorithms in PDF only on Docsity!

CS 367 Announcements

Thursday, February 6, 2014

Homework h1 due 10 pm tomorrow, February 7th Homework h2 assigned tomorrow Program p1 due 10 pm Sunday, February 16th

Handin directories have been created. Assignment questions? Post on Piazza or see a TA during lab consulting hours.

Last Time Exceptions

  • throwing
  • handling
  • execution
  • practice with exception handling

Today Exceptions

  • throws and checked vs. unchecked
  • defining Primitive vs. Reference Types
  • assignment
  • parameter passing ADTs vs. Data Structures Command Line Java Development Submitting Work

Next Time Chains of Linked Nodes

  • Listnode class
  • practice using

throws clause – Passing the Buck

Checked vs. Unchecked

Java Syntax

... methodName ( parameter list ) throws ExceptionType1, ExceptionType2, ... { ... }

Example

public static void main(String[] args) throws IOException { ...

Primitive vs. Reference Types: Assignment

Primitives

int x, y, z; x = 7; y = x; z = x; y = 10; z = 8;

References

ArrayList x, y, z; x = new ArrayList(); y = x; z = x; y = new ArrayList(); z.add("Madison"); y.add("Wisconsin");

Primitive vs. Reference Types: Parameter Passing

Primitives

Given:

void mod1(int x) { x = 7; }

Execute (assume in main):

int x = 1; int[] y = {1, 2, 3}; mod1(x); mod1(y[2]);

References

Given:

void mod2(int[] x) { x[0] = 7; }

void mod3(int[] x) { x = new int[x.length]; x[0] = 14; }

Execute (assume in main):

int[] a = {1, 2, 3}; mod2(a); mod3(a);

Command Line Java Development

Edit

Compile

Run