Shortest Path
Generalize distance to weighted setting
Digraph G = (V,E) with weight function W: E R
(assigning real values to edges)
Weight of path p = v1 v2 vk is
k1
w( p) w(vi , vi 1 )
i 1
Short
Trie Structure
Tries Lexicographical Search
Tree
Name comes from middle letters of
word retrieval, rhymes with pie
Represents strings of any type such as
characters
Each path from root to a leaf is on
1
Features of OOP
Emphasis on data rather than
procedure.
Programs are divided into objects.
Data structures are designed such
that they characterize the objects.
Functions that operate on the dat
1
Inheritance : Extending classes
C+ strongly supports the concept of
reusability.
C+ classes can be reused by creating
new classes and reusing the properties of
existing classes.
New class can be
1
Brief Notes on C
Structure of C program
Include files
#include <stdio.h>
/for input/output functions
Define Constant
#define const_name value
main program
main()
cfw_ /* each declarations and
statem
Graph - 3
Shortest-Path Problems
Shortest-Path problems
Single-source (single-destination). Find a shortest
path from a given source (vertex s) to each of the
vertices.
Single-pair. Given two vertic
1
What is C+ ?
C+ is a Object oriented programming
language. Initially named as C with
classes.
C+ was developed at AT & T Bell
Labs.
C+ is superset of C.
Three important facilities are added
onto
Priority Queues
What is a PRIORITY QUEUE?
2
Queue that gives access ONLY to the MINIMUM item
Items ARRIVE in ANY order
Items EXIT in MINIMUM order
Priority Queue as an Abstract Data Structure
Priority
Balanced Binary Trees
Red-Black Trees
Red-Black Trees
What are they?
A redblack tree is a data structure which is a
type of self-balancing binary search tree.
Their relation to 2-4 trees (B-trees of
Graph - 2
Minimum Spanning Trees
1
Some Graph Operations
Traversal
Given G=(V,E) and vertex v, find all wV,
such that w connects v.
Depth First Search (DFS)
preorder tree traversal
Breadth First Sea
Graph - 1
Acknowledgement:
Material taken from Fundamentals of Data
Structures in C, Ellis Horowitz and Sartaj Sahni
1
Definition
A graph, G=(V, E), consists of two sets:
a finite set of vertices(V),
Data Structure
Lecture 3
Data Structure
Formally define Data structure as:
DS describes not only set of objects but the
ways
they are related,
the set of operations which may be applied to the
eleme
Stack-Queues
Lecture 4
Different kinds of list
Commonly used variation of lists are:
Stack
Queue
Dequeue
Stack
A stack is a data structure that works like a
stack of items, such as pile of plates i
B+ Tree
What is a B+ Tree
A B+ tree is a balanced tree in which every path from
the root of the tree to a leaf is of the same length.
Each non-leaf node of the tree has between [n/2] and
[n] children,
Multi-Way Search Trees
(B Trees)
Multiway Search Trees
An m-way search tree is a tree in which, for
some integer m called the order of the tree,
each node has at most m children.
If n <= m is the numb
Graphs Definition
A graph G = (V,E) is composed of:
V: set of vertices
EVV: set of edges connecting the vertices
An edge e = (u,v) is a pair of vertices
(u,v) is ordered, if G is a directed graph
Teach yourself Java module
COL106 (Sem I, 2015-16)
Chinmay Narayan and Prathmesh Kallurkar
July 29, 2015
The aim of this Java lab module is to kick-start students in programming Java
by introducing th
Simulation of Memory Allocator Module
Posting date: 6/March/14
Submission date: 19/March/14 by 10pm
Demo: 20-24th March/14
Total: 20 Marks
Problem statement:
Write a C/C+ program to allocate memory to
Assignment 1 (Total marks 13+2) : Here 2 marks are reserved for well documented and
correct program for all kinds of inputs data.
Last date of submission: 22nd Jan by 5pm ; Last date for Demo : latest
1
Stack Controller
The stack controller is a device which when given an input either accepts the
input or rejects it. Internally the stack controller maintains a
set of rules,
stack
lookup table ge
CSL 201, IIT Delhi
Assignment 4 - Part I
Searching Points in a one dimensional(1-D) range
Announce Date : 04.04.2014
Due Date : 12.04.2014
This part of the assignment is based on one dimensional(1-D)
CSL 201, IIT Delhi
Assignment 4 - Part III
Searching Points in Multi-dimensional Range
Announce Date : 12.04.2014
Due Date : 21.04.2014
This part of assignment is based on multi dimensional range sear
Binary Heaps
Delete-min
Building
a heap in O(n) time
Heap Sort
1
Delete-min
The
minimum element is the one at the
top of the heap.
We can delete this and move one of its
children up to fill the s
Insertion in red-black trees
a-b trees
What are they?
Insertion and deletion in a-b trees
Insertion in red-black trees
Let
k be the key being inserted
As in the case of a BST we first search for
k
Red-Black Trees
What are they?
Their relation to 2-4 trees
Deletion in red-black trees
Red-Black Trees
A red black tree is a binary search tree in which
each node is colored red or black.
The root
Case Study: Searching for Patterns
Problem: find all occurrences of pattern P
of length m inside the text T of length n.
Exact matching problem
1
String Matching - Applications
Text
editing
Term re
Priority Queues
Scheduling example
The priority queue ADT
Implementing a priority queue with a sequence
Binary Heaps
Insertion in a Heaps and Heapify
1
Scheduling
In a multi-user computer system, mult