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
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
Graph theory
-Vertices set of nodes
V = cfw_v1, v2, v3, v4, vn
E = cfw_e1, e2 e3, e4, en
E = v+1
Graph G = (V,E)
Graph
Undirected
directed
1
B
A
D
3
11
7
C
9
5
Ex.
e3
e4
V3
V2
e2
e5
V1
e1
edges
e1
e2
e3
e4
e5
)End points edge set v(e
cfw_v1
cfw_v1,v2
cf
Skip navigation
EG
0
Notifications
[email protected]
Change
mohammed mokhtar
Creator Studio
Add account Sign out
Search
Home
My channel
Trending
Subscriptions 65
Library
History
Watch Later
Liked videos
Most relevant
New activity
A-Z
Subscription
Exercises on BST
Beginner's Review Exercises
A. Fill in the blank of each statement.
1. A binary tree is a tree in which no node can have more than ( ) subtrees.
2. The height of a binary tree can be related to the ( ) of nodes in the tree.
3. If the heig
Exercises on Stack
Beginner's Exercises
1. What operation adds an item to the top of a stack?
2. What operation removes an item from the top of a stack?
3. Which stack operation is prohibited on an empty stack?
4. What does LIFO mean?
5. What is a recursi
Exercises on lists
Beginner's Exercises
1. What is a structure?
2. What is a self-referential structure?
3. What is a link in a linked list?
4. What is a linked stack?
5. What is a linked queue?
6. What are the advantages of using a linked list over using
Exercises on Queue
Beginner's Exercises
1. Compute the value of f and g in the following code fragment and correct the
illegal statements, if there are any.
int a = 3;
int b = 7;
int c;
int *f;
int *g;
f=&a;
g = &b;
g = a;
c= f;
2. Define an ADT that desc
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
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
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
Exercises on graphs
1. Define the following terms: Graph, directed graph, spanning tree, light edge,
connected component, cycle, topological order, degree, in-degree, out-degree, path.
2. For the following graph determine:
(a) Its adjacency matrix represe
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? First In First Out (FIFO)
In a queue,
new values are always a
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
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
Graphs (Ch. 11)
A graph G consists of a set V, called the vertices of G,
and, for all
What is a Decision Tree?
A Visual Representation of Choices,
Consequences, Probabilities, and
Opportunities.
A Way of Breaking Down
Complicated Situations Down to
Easier-to-Understand Scenarios.
Decision Tree
Notation Used in Decision Trees
A box
is us
Decision analysis
Decision Analysis
CHAPTER 3
Decision analysis
INTRODUCTION
- The successes or failures depend on decisions
- Decision theory is analytic and systematic approach to
study decision making
- What make differences between good and bad
decisi