The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 1112 Algorithms and Data Structures
Spring 2014 Project 3
Due Date: April 22, 2014
Instructor: A. Bellaachia
Dictionary BST Using Dynamic Linked
Tree Structures
Definitions:
o A tree is a connected acyclic graph.
o A disconnected acyclic graph is called a forest
o A tree is a connected digraph with these properties:
There is exactly one node (Root) with in-degree=0
All other nodes have in-degre
Stacks
Definitions:
o It is an LIFO ADT
o It is a list of elements where a new element is inserted or
pushed and deleted or popped only at the top of the list.
o Only the element at the top of the list is accessed
Example:
Operations:
o isEmpty: checks
Recursion
Definition:
o A procedure or function that calls itself, directly or indirectly, is
said to be recursive.
Why recursion?
o For many problems, the recursion solution is more natural than
the alternative non-recursive or iterative solution
o It
Linked Lists Structures
Motivation:
o Insertion & Deletion in an ordered array require moving
elements up or down (left or right).
o Manipulating ordered lists of varying sizes
Example:
a
a
a
b
b
b
d Delete(d) =>
f
f
f
m Insert(k) =>
k
m
m
Solution:
o
Priority Queues
Definitions:
o A priority queue is a restricted form of a list, where items are
arranged according to their priorities (or keys). The key assigned to
an item may not be unique.
o The item with highest priority is removed in O(1).
o Each n
Queues
Objectives:
o Real life examples
Waiting in line
Waiting on hold for tech support
o Applications related to Computer Science
Threads
Job scheduling
Definition:
o It is an FIFO ADT
o A new element is added or inserted to the end of the list
o
Hashing
Goal:
o Perform insertions, deletions, and search in constant
time: O(1).
o Example:
Many compilers use Hashing to implement their symbol
tables
Hash Tables:
o A hash table is an ADT where insertion, deletion, and search
take a constant time: O
Course Summary
Performance Analysis
o Estimation of required resources such as memory space, computational
time, and communication bandwidth.
o Comparison of algorithms
o Common time functions:
If F is:
Say that F is:
If F is:
Say that F is:
O(nr), 1<r<2
Performance Analysis
Motivation:
o Estimation of required resources such as memory space, computational
time, and communication bandwidth.
o Comparison of algorithms
Model of implementation:
o One-processor RAM (random-access machine) model.
o Single op
Arrays, Vectors, Matrices
Goal:
o Scientific Eng.
o Numerical computations
o Array are very efficient way of organizing data since accessing
array elements requires O(1).
Characteristics of an array:
o Arrays are one the main data organization
o Arrays
Abstraction and Abstract Data Types
Abstraction:
o Whatever is visible to the user?
Examples: Variable names & real numbers.
o How real numbers are implemented?
o How arrays are implemented?
The abstraction is rectangular arrays
The implementation is
Sample Questions
Csci 1112
A. Bellaachia
Important Series :
N
S ( N ) 1 2 N i N (1 N ) / 2
i 1
o Sum of squares:
N
N ( N 1)(2 N 1) N 3
for large N
i2
6
3
i 1
o Sum of exponents:
N
N k 1
for large N and k -1
ik
| k 1|
i 1
o Geometric series:
N i AN 1 1
The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 1112 Algorithms and Data Structures
Spring 2014 Project 1
Due Date: March 18, 2014
Instructor: A. Bellaachia
Description:
In this project, you a
The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 1112 Algorithms and Data Structures
Spring 2014 Project 2
Due Date: April 3, 2014
Instructor: A. Bellaachia
Polynomial Operations
Description
Yo
The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 1112 Algorithms and Data Structures
Spring 2014 Project 4
Due Date: April 29, 2014 Midnight -Instructor: A. Bellaachia
Sorting
Description:
In c
Graphs
Motivations:
o Networks
o Social networks
o Program testing
o Job Assignment
Examples:
o Code graph:
S1
S1: int x
S2: If x > 0 then
S3:
Else
S4:
S2
X = x + 2;
S3
S4
X =x -1;
End if
S5
S5: While x > 1 do
S6:
Print x;
S7:
X = x -1;
End while
CSci 1