The efficiency of inserting into an ideally balanced binary tree is
big-O of:
Log (2) n
The efficiency of a lookup into an ideally balanced binary tree is
big-O of:
Log (2) n
The efficiency of a remove from an ideally balanced binary tree is
big-O of:
Log

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee,
Rakesh Varna, & Roshni
Chandrashekhar]
2
Announcements
Dont copy code. Not even starter code.
Watch Piazza for announcements about
rescheduled midte

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee,
Rakesh Varna, & Roshni
Chandrashekhar]
2
Announcements
1.
HW4 posted: START NOW!
MRUList vs LinkedList on p&p.txt
Mapping between single linked list

CSE 12 Final Review WARM-UP: trace this
If arr = cfw_64, 25, 12, 22, 1 what is the output? (work individually on paper)
void sort(int[] arr) cfw_
System.out.println("Start value: " + Arrays.toString(arr);
for (int start = 0, end = arr.length - 1; start <

Last Time
Our URL: http:/cse12.instructures.org/
Arrays and the subscript operator
Parameter: a variable, local to a method, set by the caller
Argument: the value that the parameter gets initialized to
- A method has only a single denition
- A method can

Basic Data Structures
Our URL: http:/cse12.instructures.org/
This course covers the implementation of several foundational
data structures:
- Linked Lists
- Stacks
- Queues
- Deques
And the use of several fundamental data structures:
- Hash tables: Has

Operating on Arrays
and Subarrays
Working with Arrays
Printing an array
Copying portions of an array
What can we do with (sub)arrays?
- Print the contents of a subarray
Merge Sort
- Clear the contents of a subarray
- Copy the contents from one subarray

CSE 12 Summer 2015
Written Assessment #1
Due: Monday, July 6
Last Name: _ (as on your ID)
First Name: _
ID: _
Score:
/ 100
Instructions: Write your solutions to the following ve problems in the space
provided. Read each problem carefully and recheck your

CSE 12 Summer 2015
Written Assessment #2
Due: Wednesday, July 15
Last Name: _ (as on your ID)
First Name: _
ID: _
Score:
/ 100
Instructions: Write your solutions to the following four problems in the space
provided. Read each problem carefully and recheck

Implementing a LinkedList
Lets use induction
How can we make a sequence that holds one element?
Now, given a sequence with n elements, how can we make it
hold n + 1 elements?
1
insertAfter
New
value: "q"
Pos
Xnd
value: "A"
value: "B"
left
left
right
ri

More Java Collections
Comparators
Maps
Time and Space Analysis
Counting steps for selection and insertion sort
Big-O notation
Merge Sort (Wednesday)
A recursive sort procedure that requires only nlog(n) steps
Time and space analysis of merge sort
1

Announcements
PA2 has been released, due July 16 (Thurs) at
9pm.
No late submissions will be accepted.
1
Dynamic Memory Allocation
CSE 30
2
node *list_add(node* head, char *string)
cfw_
node *new_node=(node*) malloc(sizeof(node);
new_node->value = (char*

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee,
Rakesh Varna, & Roshni
Chandrashekhar]
2
Announcements
HW3 posted have you started?
1.
A.
B.
C.
D.
No, not at all
Ive read it
Ive started solving th

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee]
2
Announcements
HW3 posted have you started?
Tutor hours: VERY CROWDED near
deadline
Tutor hours rules:
1.
2.
3.
1.
2.
Your code must be indented pr

The efficiency of the Linked-List based Stack push function is bigO of:
1
The efficiency of the Linked-List based Stack pop function is big-O
of:
1
The efficiency of the Linked-List based Stack top function is big-O
of:
1
The efficiency of the Linked-List

CSE 12
Fundamental Data Structures: The Array and
Linked Structures
Implementations of the List ADT
Properties of array and linked implementations
Separate and inner node classes
Singly and doubly linked lists
05
Introduction
Any interface specification

CSE 12
The Queue Abstract Data Type
The Queue ADT
Designing a test plan for Queue
The Adapter pattern again
Alternative implementations of Queue
Circular arrays
Time costs of Queue implementations
The Queue ADT
Queue: a First-In-First-Out (FIFO) dat

CSE 12
Sorting and Searching
Sorting terminology
Basic sorting algorithms
Time and space costs of sorting
Comparisons and swaps
Comparing primitive types vs. comparing Objects
The Comparable and Comparator interfaces
12-1/43
Sorting and ordering
To

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee]
2
Todays Topics
1.
2.
Introduce myself to you
Course structure and procedures:
3.
4.
Your Grade
My role
Your role
Rules
Quick overview of the course

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee]
2
Announcements
1.
2.
3.
HW1 posted, tutor hours start today!
Post midterm/final conflicts on Piazza
Ways of working remotely
3
Todays Topics
Introd

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee]
2
Announcements
1.
HW2 posted tomorrow. When it is, DONT
WAIT to read it, though youll need
Wednesdays material to really dig in
3
Todays Topics
1.

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee]
2
Discussion sections
Both will have 30 min review of basic
topics
Last 20 mins will be:
1.
2.
1.
2.
Monday: student directed questions on
current H

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee]
2
Announcements
HW2: Hows it going?
1.
A.
B.
C.
D.
E.
I havent even read it
Ive read it, but havent started coding
Ive just started coding
Im well o

CSE 12 Basic
Data Structures
Prof. Christine Alvarado
[Slides borrowed/adapted
from slides by Cynthia Lee]
2
Announcements
1.
HW3 posted, code available tomorrow
morning, but theres plenty to do in the
meantime
f1 is O(f2)
A.
B.
TRUE
FALSE
2500
f1
2000
15

CSE 12 Summer 2015
Written Assessment #3
Due: Monday, July 27
Last Name: _ (as on your ID)
First Name: _
ID: _
/ 100
Score:
Instructions: Write your solutions to the following four problems in the space
provided. Read each problem carefully and recheck yo