1. Introduction to graphs
The Graph ADT (2/13)
A graph G consists of two sets
a finite, nonempty set of vertices V(G)
a finite, possible empty set of edges E(G)
G(V,E) represents a graph
An undirected graph is one in whi
Access is allowed only at one point of the structure,
normally termed the top of the stack
access to the most recently added item only
Operations are limited:
push (add item to stack)
pop (remove top item from stack)
A Tree is either
Empty(no nodes) or
a root and zero or more subtrees.
Path: Traversal from node to node along the edges results in a
sequence called path.
Root: Node at the top of the tree.
Parent: Any node
1. Introduction to Data Structures
Entity and Attributes
A school teacher wants to maintain student details.
Asymptotic Intuition: To get a intuitive feeling for what common asymptotic
running times map into in terms of practical usage, here is a little list.
(1): Constant time; you cant beat it!
(log n): This is typically the spee
The NP-completeness of Subset Sum
Pilu Crescenzi and Viggo Kann
University of Florence and KTH
Crescenzi and Kann (UniFi and KTH)
Set of decision problems that admit short and efficiently
Binary Search Tree
Binary Search Tree, is a node-based binary tree data structure which
has the following properties:
The left subtree of a node contains only nodes with keys less
than the nodes key.
The right subtree of a node contains only nodes with
1. Dijkstra Algorithm
for each vertex v:
v's distance := infinity.
v's previous := none.
v1's distance := 0.
List := cfw_all vertices.
while List is not empty:
v := remove List vertex
1. Single Linked List
Advantages of Linked List over Array
We can access any element directly
It can be used to create other useful data
It is light on memory usage.
CITY UNIVERSITY OF HONG KONG
DEPARTMENT OF ELECTRONIC ENGINEERING
EE3900 Computer Networks
1. A channel has a data rate of 4kbps and a propagation delay of 20 ms. For what
range of frame sizes does stop-and-wait give an efficiency of at least 5
Bubble sort is a simple and well-known sorting algorithm.
Given a list , we iterate through the items, swapping them if they are out of order.
Bubble sort belongs to O(n2) sorting algorithms, which makes it quite inefficient
for sorting large
The sorting techniques that we have seen so far sorts the list of elements by
comparing the sequence of elements and swaps them if necessary. The radix sort also
referred, as the bucket sort is little bit different.It manages to sort values wi
< Day Day Up >
Chapter 22: Graphs
Graphs are natural models that are used to represent arbitrary relationships among data
objects. We often need to represent such arbitrary relationships among the data objects
while dealing with proble
Another name - Sinking sort
The idea of bubble sort is to repeatedly move the smallest
element to the lowest index position in the list.
To find the smallest element, the bubble sort algorithm
begins by comparing the first element o
Sequential Search (Linear Search)
Indexed Sequential Search
is also referred as sequential search, is the
simplest searching technique.
The search begins at one end of the list and
- non linear DS
A typical Tree Data Structure
- Parent child relationship
Levels of a tree
No node of a tree can have a degree of more than 2.
there is a specially designated node cal