10/3/17
CSCI-2320
Syntactic Analysis
(Ch 3 &
Wikipedia for CYK)
Mohammad T. Irfan
AKA "parser"
Stream of
tokens
Parser
Parse tree/
syntax error
Question: What is the grammar?
1
10/3/17
Parsing algo
Computer Science 210:
Data Structures
Introduction
Welcome to Data Structures!
Data structures are fundamental building blocks of algorithms and programs
Csci 210 is a study of data structures
abstr
csci 210: Data Structures
Program Analysis
1
Summary
Summary
analysis of algorithms
asymptotic analysis
big-O
big-Omega
big-theta
asymptotic notation
commonly used functions
discrete math refresher
RE
Computer Science 210:
Data Structures
Arrays
Summary
Today
arrays
arrays of objects
in-class: add an entry into an array
Reading:
Collections of data
The most common thing you want to do when wr
csci 210: Data Structures
More Recursion
Summary
Topics: more recursion
Subset sum: finding if a subset of an array that sum up to a given target
Permute: finding all permutations of a given string
Computer Science 210:
Data Structures
Sorting
Sorting
Given a sequence of elements, sort them
More precisely:
Input:
an array a = [a0, a1, a2, . ]
the elements are comparable to each other (we can
Computer Science 210:
Data Structures
Searching
Searching
Given a sequence of elements, and a target element, nd whether the target
occurs in the sequence
Variations:
nd rst occurence; nd all occure
Homework 4
Due Tuesday October 27th before class time
It is possible to implement queues using an array such that both enqueues and
dequeues take O(1) time, in the case when we know the maximum size o
Homework 2
Due Wed September 23th
(1) Suppose you are comparing implementations of insertion sort and selection sort
on the same machine. For inputs of size n, insertion sort runs in 8n2 + 20n
instruc
Homework 3
Due October 15th
Check out the java skeleton for drawing the Sierpinski triangles on the class
website. Fill in the details of method sdraw.
public void sdraw(Point p1, Point p2, Point p3)
Final Review
1.
REVIEW TOPICS
Java basics
Sorting and searching
linear and binary search
bubble sort, insertion sort, selection sort
Linked lists
lists vs. arrays
operations on lists and analysis
sing
Computer Science 210:
Data Structures
Linked lists
Arrays vs. Linked Lists
Weve seen arrays:
int[] a = new int[10];
a is a chunk of memory of size 10 x sizeof(int)
a has a xed size
a[0] a[1] a[2]
Csci 210 Lab: Terrains
(Laura Toma)
Overview
Test grids:
brunsdem.asc
kaweah.asc
sierra.asc
test1.asc
test2.asc
srtm_21_05.asc
srtm_22_04.asc
Vast amounts of terrain data is available from remote sens
csci 210: Data Structures
Recursion
Summary
Topics
recursion overview
simple examples
Sierpinski gasket
counting blobs in a grid
Hanoi towers
Recursion
A method of defining a function in terms of it
Csci 210 Lab: Vizualizing Terrains
(Laura Toma)
Overview
Vast amounts of terrain data is available from remote sensing technology. Most data available is
in the form of aerial photographs. Photographs
Data Structures
Day 1:
Object Oriented Programming:
o Designing classes and specifying interactions among classes
Data
Methods
o Write a program that creates instances of the classes that interact t
Hash Tables, Binary Search Trees, AVL Trees, Priority Queues & Heaps
Hash Table:
Hash code: function that maps general keys to corresponding indices in a table; ideally keys will
be distributed in th
Chapter 1:
Method: an executable statement belonging to a class; blocks of code that can be called
to perform actions; can accept parameters as arguments; reference types
o Reference variable: a varia
9/15/17
CSCI 2320
Syntax
MOHAMMAD T. IRFAN
Review of [email protected]
(see classnote)
Syntax (form): expressed by grammar
CFG/BNF: (1) terminal (2) nonterminal (3) producEon
SentenEal form
Sentence
8/30/17
CSCI 2320
Principles of Programming
Languages
Introduction
Mohammad T. Irfan
[email protected]
www.bowdoin.edu/~mirfan
Office Hours:
Tue 2:304:30
Wed 46
Course Information
u
Syllabus
u
Gradi
Data Structures Readings Notes:
Algorithm Analysis:
Data Structure: a systematic way of organizing and accessing data
Algorithm: a list of precisely defined steps that can be done by a computer in a
/*
*
*
*
*
*
*
*
*
*
*
*
*/
Author: Stephen Majercik
Cylinder Class
15 September 2016
This class is a very simple Cylinder class that extends the Circle
class. The only additional instance variable is
/*
*
*
*
*
*
*
*
*/
Author: Stephen Majercik
Inheritance Example
15 September 2016
This program performs a few simple tests using the Circle class
and the Cylinder class (which extends the Circle clas
/*
*
*
*
*
*
*
*
*
*/
Author: Stephen Majercik
Circle Class
15 September 2016
This class is a very simple Circle class. The only instance variable
is the radius of the circle. A few simple methods are
Csci 210 Lab 5 & 6: Boggle
(Laura Toma adapted from Eric Chown)
Overview
In this assignment, you will implement the back-end logic for a graphical version of the popular
board game Boggle. Specificall
Csci 210 Lab: Sudoku
(Laura Toma adapted from Eric Chown)
Overview
In this lab we are going to use search to solve the game Sudoku. In Sudoku the goal is to
complete a grid of numbers. When finished e