Homework #3
CS 163 Data Structures
Answer the following questions:
Write C+ to determine the following for a binary search tree, implemented using a non-linear linked list:
1) Write functions to perform the following:
a) display the smallest item in a bin
Programming Assignment #2
CS 163: Data Structures
Spring 2011
Problem Statement:
The goal of program #2 is to gain experience with stacks and queues.
We have been hired by CS Airways. They would like to use the process of stacks and
queues to automate the
Programming Assignment #1
CS 163 Data Structures
Scope:
When beginning with this project, the first thing to keep in mind is that we only
have approximately 2 weeks to complete each assignment. Therefore, it is critical
that you focus on a limited scope.
Data Structures
Topic #2
1
Todays Agenda
Data Abstraction
Given what we talked about last time, we need
to step through an example of an abstract data
type using
classes,
constructors,
member functions,
data hiding,
distinguishing the difference between
Data Structures
Topic #9
Todays Agenda
Continue Discussing Trees
Examine the algorithm to insert
Examine the algorithm to remove
Begin discussing efficiency of tree
Are there any alternatives?
2-3
2-3-4 (next time)
red-black trees (next time)
AVL (next ti
Data Structures
Topic #6
Todays Agenda
Table Abstract Data Types
Work by value rather than position
May be implemented using a variety of data structures
such as
arrays (statically, dynamically allocated)
linear linked lists
non-linear linked lists
Data Structures
Topic #5
Todays Agenda
Other types of linked lists
discuss algorithms to manage circular and
doubly linked lists
should we use a dummy head node? What are
the advantages and disadvantages
what about arrays of linked lists, or linked li
Data Structures
Topic #3
Todays Agenda
Ordered List ADTs
What are they
Discuss two different interpretations of an
ordered list
Are manipulated by position
Use of Data Structures for Ordered Lists
arrays (statically & dynamically allocated)
linear
Data Structures
Topic #8
Todays Agenda
Continue Discussing Table Abstractions
But, this time, lets talk about them in
terms of new non-linear data structures
trees
which require that our data be organized in a
hierarchical fashion
Tree Introduction
R
Data Structures
Topic #13
Todays Agenda
Sorting Algorithms: Recursive
mergesort
quicksort
As we learn about each sorting algorithm,
we will discuss its efficiency
Review for the Final Exam
Mergesort
The mergesort is considered to be a divide and
con
Programming Assignment #3
CS163: Data Structures
Overview:
Hash tables are very useful in situations where an individual wants to quickly find
their data by the value or search key. You could think of them as similar to an
array, except the client program
Trees
Content
Introduction
Binary Trees
Heaps
Binary Search Trees
Selection Trees
Forests
Set Representation
2
Introdcution
Example
Computer Company
Sales
Canada
Europe
Manufacturing
International
Asia
Laptops
R&D
Desktops
US
3
The Definition of Tree (1)
Hashing
Content
Introduction
Static hashing
Dynamic hashing
2
Introduction
A table has several fields (types of
information)
A telephone book may have fields name, address,
phone number
A user account table may have fields user id,
password, home fo
Heap structures
Content
Recall Max or Min Heaps
Min-Max Heaps
Applications
2
Recall Heaps
Heap is also called priority queue
An application of complete binary tree
Definition
A max (or min) tree
a tree in which the key value in each node is no sma
Advanced Search Trees
Content
Introduction
AVL Trees
2
Introduction
Binary search trees
Search, insert, delete: O(log n) time complexity
UNLESS they become unbalanced (trees are
degenerate)
search, insert, delete: O(n) time complexity
3
Introduction
Graphs
Content
Terminology
Graph Representations
Elementary Graph Operations
Minimal Spanning Trees
Shortest Paths
2
Terminology
A graph G=(V,E), V and E are two sets
V: finite non-empty set of vertices
E: set of edges (pairs of vertices)
Undirected g
Sorting
Content
Introduction
Insertion Sort
Selection Sort
Bubble Sort
Quick Sort
Merge Sort
Heap Sort
Radix Sort
2
Introduction
How do you find your name on a class list?
How do you search a book in a library?
How do you find a word in a dictionary?
Arrays and Structures
Content
Abstract Data Type
The array abstract data type
Structures and unions
The polynomial abstract data type
The sparse matrix abstract data type
Representation of multidimensional arrays
The string abstract data type
2
Abstract D
Stacks and Queues
Content
Stacks
Implementation of stacks using array
Queues
Implementation of queues using array
Examples
Multiple stacks and queues
2
Stacks
A stack is an ordered list in which insertions and
deletions are made at one end called the top
Algorithm Analysis
1
Content
Algorithm Concept
Algorithm Analysis
Analysis approaches
Worst-case, Average-case and Best-case
Asymptotic notations
Running time calculations
2
What is an algorithm?
Data structures
Methods of organizing data
What is Algor
C Language Review
1
Content
Basics of C language
Recursion
2
Overview of C
C is developed by Dennis Ritchie
C is a structured programming language
C supports functions that enables easy
maintainability of code, by breaking large file into
smaller mod
Data structure
Instructor Information
Ioannis Parissis
Email: ioannis.parissis@grenoble-inp.fr
TA: The Nghia Nguyen
Email: ntnghia@dut.udn.vn
Office: IT Faculty
2
Objectives
Understand data structures (lists, trees, hash tables)
Understand graph represent