Docsity

Midterm Exam 1 Review - Introduction to Data Structures | COMP SCI 367, Study notes of Data Structures and Algorithms

Toggle sidebar
bg1
Copyright 2014 Jim Skrentny CS 367 L11 - 1
CS 367 Announcements
Tuesday, February 25, 2014
Midterm Exam 1
• Tuesday, March 4, 5:00 pm
• Exam information posted
• Exam makeups scheduled
Homework h4 due 10 pm Friday, February 28th
Program p2 due 10 pm Sunday, March 9th
Last Time
Complexity
• analyzing algorithms practice
• big-O notation
• analyzing Java code
• analyzing Java code practice
Today
Complexity
• significance of scaling
• complexity caveats
Comparing ArrayList vs LinkedList
• shadow array - improving array resizing
Position-oriented ADTs
Next Time
Read: Stacks and Queues
• Stack ADT and implementations
• Queue ADT and implementations
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Midterm Exam 1 Review - Introduction to Data Structures | COMP SCI 367 and more Study notes Data Structures and Algorithms in PDF only on Docsity!

CS 367 Announcements

Tuesday, February 25, 2014

Midterm Exam 1

  • Tuesday, March 4, 5:00 pm
  • Exam information posted
  • Exam makeups scheduled

Homework h4 due 10 pm Friday, February 28th

Program p2 due 10 pm Sunday, March 9th

Last Time Complexity

  • analyzing algorithms practice
  • big-O notation
  • analyzing Java code
  • analyzing Java code practice

Today Complexity

  • significance of scaling
  • complexity caveats Comparing ArrayList vs LinkedList
  • shadow array - improving array resizing Position-oriented ADTs

Next Time Read: Stacks and Queues

  • Stack ADT and implementations
  • Queue ADT and implementations

Returning N Papers to N Students

problem size (N) = dominant operation =

 What is the complexity of each algorithm below?

Algorithm 1: call out each name, have student come forward & pick up

best-case:

worst-case:

Algorithm 2: hand pile to first student, student searches through papers & takes hers/his, pass pile to next student who does likewise

best-case:

worst-case:

Algorithm 3: sort the papers alphabetically, hand pile to first student who does binary search, pass to next student who does likewise

Complexity Caveats

Small Problem Size

Same Complexity

Comparing List ADT Implementations

Space Requirements

 Problem size N =?

Array:

Singly-Linked List:

Circular Singly-Linked List:

Doubly-Linked List:

Circular Doubly-Linked List:

Shadow Array – Improving Array Resizing

"Naïve" Approach

"Shadow Array" Improvement

Comparing List ADT Implementations

Ease of Implementation

Array:

Singly-Linked List:

Circular Singly-Linked List:

Doubly-Linked List:

Circular Doubly-Linked List: