Helwan University
2nd Level
Faculty of Computers and Information
Algorithms
Computer Science Department
Spring 2016
Sheet 4 (Heap Sort)
1. What are the minimum and maximum numbers of elements in a heap of height h?
2. *Is the sequence 23, 17, 14, 6, 13, 1
Helwan University
2nd Level
Faculty of Computers and Information
Algorithms
Computer Science Department
Spring 2016
Sheet 5
1. Apply the quicksort to sort the list A = cfw_ E,X,A,M,P,L,E.
2. *Sort the following list in increasing order using quick sort te
CS 316: ALGORITHMS
Dr. Wessam El Behaidy
Dr. Ensaf Hussein
Department Of Computer Science
SPRING 2016
4/12/2016
GRAPH REPRESENTATION AND
SEARCH
LECTURE 8
APPLICATIONS
Applications that involve not only a set of items, but also the
connections between them
CS 316: ALGORITHMS
Lecture 10
Graph
Single-Source Shortest Path
Dr. Wessam El-Behaidy
Dr. Ensaf Hussein
Department Of Computer Science
4/28/2016
SHORTEST PATH
Generalize distance to weighted setting
Digraph G = (V,E) with weight function W: E R
(assigning
Helwan University
2nd Level
Faculty of Computers and Information
CS 316 Algorithms
Computer Science Department
Spring 2015
Sheet 3
1. Give traces, showing how the following keys are sorted with mergesort.
a) * <Q, U, E, S, T, I, O, N>
b) <5,4,2,1,3,2>
2.
Helwan University
2nd Level
Faculty of Computers and Information
CS 316 Algorithms
Computer Science Department
Spring 2016
Sheet 2
Q1:
Algorithm 1
/Input: Two matrices A, B
For i 0 to n-1do
For j 0 to n-1 do
C[I,j] 0
For k 0 to n-1 do
C[I,j] c[I,j] + A[I,
CS 316: ALGORITHMS
Dr. Wessam El Behaidy
Dr. Ensaf Hussein
Department Of Computer Science
SPRING 2016
5/22/16
GRAPH
MINIMUM SPANNING TREES
(MST)
LECTURE 9
APPLICATIONS OF MST
Find the least expensive way to connect a set
of cities, terminals, computers,
CS 316: ALGORITHMS
Lecture 5
Analysis Of Recursive Algorithms
Dr. Wessam El Behaidy
Dr. Ensaf Hussein
Department Of Computer Science
SPRING 2016
3/18/2016
OUTLINE
Divide and Conquer Algorithms
Merge Sort
Analysis of recursive algorithms
Substitution
It
CS 316: ALGORITHMS
Lecture 7: Quick Sort
Dr. Wessam El Behaidy
Dr. Ensaf Hussein
Department Of Computer Science
SPRING 2016
3/27/2016
QUICK SORT
88 52
14
31
25 98
30
23
62
79
Divide and Conquer
QUICK SORT
Partition set into two using
randomly chosen pivot
Helwan University
2nd Level
Faculty of Computers and Information
Algorithms
Computer Science Department
Spring 2016
Sheet 7
MST & Single Shortest Path
1. *Given a complete graph with vertex set cfw_A;B;C;D;E; F and the following weights on
the edges.
a. D
CS 214: Data Structures
Recursion & Stacks Applications
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
The great importance of Stacks in OS
Finish
Start
M
Stack spa
Midterm
Closed Book
1 hours
Department of Computer Science
Data Structures
Fall 2012
Faculty of Computers and Information
MCQ: (1 mark on each).
4 wrong answers cancel one correct answer.
1. Consider the linked implementation of queues that was
studied in
CS 214: Data Structures
Graphs
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
Waleed A. Yousef 2008
Graphs (Ch. 11)
2
/P. 514: (3. Adjacency Table)
typedef struct
CS 214: Data Structures
Trees
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
Binary Trees (BT) and Binary Search Trees (BST) (Ch. 9)
As defined for the analysis of
CS 214: Data Structures
Queues
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
Motivation: Why Queue?
In a queue,
new values are always added at the rear of the li
CS 214: Data Structures
General Lists
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
Motivation: Why Lists?
In a general list:
new values are added in position de
CS 214: Data Structures
Stacks and Array-based Implementation
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
Introduction: array as a familiar data structure
Implem
CS 214: Data Structures
Abstraction and Implementation-Related Issues
(interesting)
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
* How to use a queue, a stack, an
CS 214: Data Structures
Stacks and Array-based Implementation
Slide contents follow
Kruse and Leung Data Structures & Program Design in C
Prepared by:
Waleed A. Yousef, Ph.D.
Waleed A. Yousef 2008
1
Introduction: array as a familiar data structure
Implem
Faculty of Computers and Information
Sheet #1
Q1: This problem is based on a book database with four relations:
BookAuthor(book, author, earnings)
BookReference(book, referencedBook, times)
BookReview(book, reviewer, score)
BookPublish(book, year, publish
Data Structure
Stack
By
Marwa M. A. Elfattah
Stack - What
A stack is one of the most important nonprimitive linear data structure in computer
science.
It is an ordered collection of items into which
new data items may be added/inserted and
from which it
Data Structure
Tree
By
Marwa M. A. Elfattah
Tree
Is a powerful non-liner data structure that can
be used to represent data items possessing
hierarchical relationship
It is acyclic structure of linked nodes.
Tree
A tree is a collection of nodes
The col
Data Structure
Introduction
By
Marwa M. A. Elfattah
Data Structure - What
Data is the basic entity or fact that is used in
calculation or manipulation process
Data structure is a way of organizing data
items by considering its relationship to each
other
Faculty of Computers & Information
Department : Computer Science Dep
Course
: Data Structure
Course No.
: CS 214
Review Problem Two
For all of the following problems, when it is stated in the user level you should assume that you only
have the object code
Faculty of Computers & Information
Department : Computer Science Dep
Course
: Data Structure
Course No.
: CS 214
Review Problem one
For all of the following problems, when it is stated in the user level you should assume that you only
have the object code
Data Structure
Lists
By
Marwa M. A. Elfattah
Lists
A list is an sequential set of data items.
In a general list:
new values are added in position determined
by the user.
Element is removed from a position
determined by the user.
Insertion position
Lis
Data Structure
Queue
By
Marwa M. A. Elfattah
Queue- What
A queue is linear data structure, which is a
homogeneous collection of elements in which
new elements are added at one end called rear
or tail, and the existing elements are deleted
from other end
Data Structure
Stack
By
Marwa M. A. Elfattah
Stack - What
A stack is one of the most important nonprimitive linear data structure in computer
science.
It is an ordered collection of items into which
new data items may be added/inserted and
from which it
Helwan University Faculty of Computers and Information
First year CS112 Programming Language I Academic year (2009/2010)
Task #0 Maximum of three numbers
Published Wednesday May 12th 2010. Due date is Sunday May 16th 2010. Introduction
The goal of this tr