CPE 360 –
Computational Data Structures
C
t ti
l D t St
t
and Algorithms
g
Fall 2009
Prof. Yi
P f Yingying (Jennifer) Chen
i (J
if ) Ch
Department of Electrical and Computer Engineering
Stevens Institute of Technology
1
Course Administrative
Instructor:

CpE 360 – Computational Algorithms and Data Structures
Fall 2009
Instructor: Yingying (Jennifer) Chen
Homework 5 – Due on 12/11/09 (Friday)
All solutions must be submitted in class by the due date. No late submission will be taken into
consideration. The

CPE360 – Computational Algorithms and Data Structures
Using C+ in Visual Studio .NET
by: Shant Stepanian (sstepani@stevens.edu)
Topics Covered:
• The Standard Template Library in C+
• Header file usage
• Using the Visual C+ Debugger
• File I/O
• Project a

CpE 360 – Computational Algorithms and Data Structures
Handout – C+ Review
Reference: Nicholas A. Solter, Scott J. Kleper, “Professional C+ (Programmer to Programmer)”,
ISBN: 0764574841, Wrox Publication
1
2
3
4
5
6
7

Shortest path problem - Wikipedia, the free encyclopedia
1 of 2
http:/en.wikipedia.org/wiki/Shortest_path_problem
Shortest path problem
From Wikipedia, the free encyclopedia
In graph theory, the single-source shortest path problem is the problem of findin

Minimum spanning tree - Wikipedia, the free encyclopedia
1 of 4
http:/en.wikipedia.org/wiki/Minimum_spanning_tree
Minimum spanning tree
From Wikipedia, the free encyclopedia
Given a connected, undirected graph, a spanning tree of that graph is
a subgraph

Greedy algorithm - Wikipedia, the free encyclopedia
1 of 2
http:/en.wikipedia.org/wiki/Greedy_algorithm
Greedy algorithm
From Wikipedia, the free encyclopedia
A greedy algorithm is an algorithm that follows the
problem solving metaheuristic of making the

Dijkstra's algorithm - Wikipedia, the free encyclopedia
1 of 4
http:/en.wikipedia.org/wiki/Dijkstra's_algorithm
Dijkstra's algorithm
From Wikipedia, the free encyclopedia
Dijkstra's algorithm, named after its discoverer, Dutch computer scientist Edsger Di

Quiz 3 Solution
CpE 360 – Computational Algorithms and Data Structures
Instructor: Ashish Patel
November 21, 2006
(Close notes, close books. Circle on your answers)
1. Represent the following arithmetic expression into Binary tree.
(x + y) * (p - q)/r) -

Quiz 2 Solution
CpE 360 – Computational Algorithms and Data Structures
Instructor: Ashish Patel
October 26, 2006
(Close notes, close books. Circle on your answers)
1. Assume that numbers 9, 3, 118, 24, 11 are pushed on a stack, three numbers are
popped, t

Quiz 1 Solution
CpE 360 – Computational Algorithms and Data Structures
Instructor: Ashish Patel
October 12, 2006
(Close notes, close books. Circle on your answers)
1) Which of the following sorting algorithm(s) cannot be stable: selection sort, merge sort

Midterm Exam
CpE 360 – Computational Algorithms and Data Structures
Instructor: Ashish Patel
Name:
_
ID Number: _
Signature:
_
All solutions must be (i) either delivered at my Lab Burchard-315 by 4:00 P.M. (ii) or
submitted per email at apatel7@stevens.ed

CS 126 Lecture P5:
Abstract Data Type
Outline
• Introduction
• Stacks (and queues)
• Stack and queue applications
CS126
6-1
Randy Wang
Data Type and ADT
CS126
6-2
Randy Wang
Interface, Implementation, and Client
Im p lem en ta tio n
Volu m e
C lien t
C

1.12.2003
Stacks, queues and linked lists
Mikko Karvonen
mkarvonen@iua.upf.es
Elementary Data Structures
Stacks, queues and linked lists are elementary data
structures that are based on pointers between some of
the elements. These pointers are links to t

Data Structures
CSCI 132, Spring 2006
Lecture 5
Stacks
1
Lists
• A list is an abstract data type consisting of an ordered group of
items.
•A list is dynamic.
Its length can vary.
• Items can be added to or deleted from the list
•There are many ways of imp

Data Structure
Chapter 3 Stacks and Queues
Juinn-Dar Huang, Ph.D.
Assistant Professor
jdhuang@mail.nctu.edu.tw
August 2004
Rev. 2005, 2006
Think Them Tedious?
Juinn-Dar Huang
What if we want to sort an array of floats
instead of ints ?
Stacks and Queues

Stacks and Queues
CpE 360 – Computational Algorithms and Data Structures
Instructor: Ashish Patel
Reference: Starting out with C+ early objects, by Tony Gaddis,
Addison Wesley, 5th Edition, ISBN: 0-321-38348-6
Static Stacks Implementation (using Arrays)
#

3
Stacks and Queues
Queues and stacks are two special list types of particular importance. They can be implemented using any list implementation, but arrays are a more practical solution for these
structures than for general purpose lists.
¿º½
ËØ
×
A st

Stacks and Queues
What is a stack/queue?
What are stacks/queues used for?
Which properties do stacks/queues have?
How can they be implemented?
(Abstract Data Types)
Dept of Computer Science
1
University of Bristol
November 19, 2004
Linear Data Structures

Stacks and Queues
Topics to be covered :
• What are ‘stacks’ and ‘queues’?
• Terminology
• How are they implemented?
• Example uses of stacks and queues
Data Structures and Algorithms
1
Stacks
A stack is a list in which all insertions and deletions are m

Stacks and Queues
CpE 360 – Computational Algorithms and Data Structures
Instructor: Ashish Patel
Stacks and queues are, perhaps the most frequently used data structures. Both are restricted
version of the linear or ordered list data structure. In fact, s

CS61B Summer 2006
Instructor: Erin Korber
Lectures 13,14,15: 18,19,20 July
Sorting
The need to sort numbers, strings, and other records arises frequently in
computer applications. The entries in any modern phone book were sorted
by a computer. Databases h

CS61B, Spring 2003
UC Berkeley
Discussion #15
Amir Kamil
4/28/03
Topics: Sorting
1
Sorting
The topic of sorting really requires no introduction. We start with an unsorted sequence, and want a sorted
sequence as the result. We begin by discussing simple bu

Sorting Algorithms
Nelson Padua-Perez
Bill Pugh
Department of Computer Science
University of Maryland, College Park
Overview
Comparison sort
Bubble sort
Selection sort
Tree sort
Heap sort
Quick sort
Merge sort
O(n2)
O(n log(n) )
Linear sort
Counting sort

Searching
• The process of finding particular elements of an array or list
• We will have a look at two searching techniques
- Linear Search (simple searching technique)
- Binary Search ( a more efficient searching technique)
Linear Search
• Basic Idea:

CSU200 Discrete Structures
Fall 2005
Profs. Aslam & Fell
September 7, 2005
Algorithms for Search
Searching and sorting are two of the most fundamental and widely encountered problems in
computer science. In this handout, we describe four algorithms for se

Zabin Visram Room CS115
CS126
Searching
Binary Search
Binary Search
Sequential search is not efficient for large
lists as it searches half the list, on average
Another search algorithm – Binary search
Very fast
But can only be performed on ordered lists

Programming & Data Structures
Tutorial 7 – Sample Solutions
Q1
(i) f(n) = 1 + N + N + N + N + N + N
= 1+ 6N
= O(N)
(ii) f(n) = 1 + lgN
= O(lgN)
Reason why it it lgN here is because variable i is doubled during
each iteration. So if we let N = 2n this is e