Search
BFS & DFS
Todays Lecture
Types of search Algorithms
Uninformed Search
Informed Search
Breadth-first searching
Depth-first search
Compare breadth first and depth first
Two main types of search
All search strategies are distinguished by the Order in
ASSIGNMENT # 2
TOPIC:
Red Black Trees
SUBMITTED To:
Sir Usman Akram
SUBMITTED BY:
Rana Sadaqat Ali
BCS-FA09-104
A
DATE:
29-05-2011
Introduction:
A binary search tree of height h can implement any of the basic dynamic set operations such as
SEARCH, PREDECE
ASSIGNMENT#2
TOPIC:
RedBlackTrees
SUBMITTEDTo:
SirUsmanAkram
SUBMITTEDBY:
Rana Sadaqat Ali
BCS-FA09-104
A
DATE:
29052011
Introduction:
A binary search tree of height h can implement any of the basic dynamic set operations such as
SEARCH, PREDECESSOR, SUCC
ASSIGNMENT # 1
TOPIC:
Exercise 6.1
SUBMITTED To:
Sir Usman Akram
SUBMITTED BY:
Rana Sadaqat Ali
BCS-FA09-104
A
DATE:
29-05-2011
Q-6.1-1: What are the minimum and maximum numbers of elements in a heap of height h?
Ans :
Since a heap is an almost-complete b
ASSIGNMENT#1
TOPIC:
01KnapSackProblem
SUBMITTEDTo:
SirUsmanAkram
SUBMITTEDBY:
Rana Sadaqat Ali
BCS-FA09-104
A
DATE:
29052011
01KnapSack:
Items are indivisible; you either take an item or not. It can be solved with dynamic programming.
First we will solve
Dynamic programming
0-1 Knapsack problem
(David Luebke) Edited By Usman
Akram For CIIT
CS 332 - Algorithms
1
01Knapsackproblem
Each item i has some weight wi and benefit value bi (all wi , bi
and W are integer values)
Problem: How to pack the knapsack t
CS332:Algorithms
NP Completeness Continued:
Reductions
What do we mean when we say a problem
is in P?
What do we mean when we say a problem
is in NP?
What is the relation between P and NP?
(David Luebke) Edited By
Usman Akram For CIIT
Review:PandNP
2
R
Dynamic programming
Longest Common Subsequence
(David Luebke) Edited By Usman
Akram For CIIT
CS 332 - Algorithms
1
Dynamicprogramming
It is used, when the solution can be recursively described in
terms of solutions to subproblems (optimal substructure)
CS332:Algorithms
NP Completeness Continued:
Reductions
Homework7
Check the web later today
(David Luebke) Edited By
Usman Akram For CIIT
Change in grading policy: drop lowest hw
2
P = set of problems that can be solved in polynomial time
NP = set of p
Insert a node at the
tail of a linked list
Problem Statement
This challenge is part of a tutorial track by MyCodeSchool and is accompanied by a video lesson.
Youre given the pointer to the head node of a linked list and an integer to add to the list. Crea
Arrays- DS
Problem Statement
An array is a series of elements of the same type placed in contiguous memory locations that can be
individually referenced by adding an index to a unique identifier.
You'll be given an array of N integers, and you have to pr
Informed Search
Todays Lecture
Informed (Heuristic) search
Heuristic evaluation function
Greedy Best-First Search
A* Search
Informed (Heuristic) search
Heuristic search is anAI search technique that
employs heuristic for its moves.
Heuristicis a rule of
Genetic Algorithms
Todays Lecture
Genetic algorithms
GA Requirements
Theory of Evolution
GA Strengths
GA Weaknesses
Genetic algorithms
Genetic algorithms were formally introduced in
the United States in the 1970s by John Holland at
University of Michigan
Print the elements of
a linked list
Problem Statement
This challenge is part of a tutorial track by MyCodeSchool and is accompanied by a video lesson.
If youre new to working with linked lists, this is a great exercise to get familiar with them. Youre giv
CS332:Algorithms
NP Completeness Continued
Review:Tractibility
E.g., Turings Halting Problem
We dont care about such problems here; take a theory
class
Other problems are decidable, but intractable:
as they grow large, we are unable to solve them in
re
CS332:Algorithms
Greedy Algorithms
Review:Dynamic
Programming
Optimal substructure: optimal solution to problem consists
of optimal solutions to subproblems
Overlapping subproblems: few subproblems in total, many
recurring instances of each
Solve botto
CS332:Algorithms
NP Completeness
Some problems are intractable:
as they grow large, we are unable to solve them in
reasonable time
What constitutes reasonable time? Standard working
definition: polynomial time
On an input of size n the worst-case runni
Asymptotic Performance
(David Luebke) Edited By
Usman Akram For CIIT
CS332:Algorithms
Review:Asymptotic
Performance
Asymptotic performance: How does algorithm behave as
the problem size gets very large?
Remember that we use the RAM model:
All memory eq
Quicksort
(David Luebke) Edited By
Usman Akram For CIIT
CS332:Algorithms
Review:Quicksort
But in practice, its quick
And the worst case doesnt happen often (but more on this
later)
(David Luebke) Edited By
Usman Akram For CIIT
Sorts in place
Sorts O(n
Introduction to Artificial
Neural Networks
Nicolas Galoppo von Borries
COMP290-058 Motion Planning
A new sort of computer
What are (everyday) computer systems good at.
and not so good at?
Good at
Not so good at
Rule-based systems:
Dealing with noisy data
CS332:Algorithms
Merge Sort
Solving Recurrences
The Master Theorem
Review:AsymptoticNotation
Upper Bound Notation:
Formally, O(g(n) = cfw_ f(n): positive constants c and n0 such
that f(n) c g(n) n n0
Big O fact:
A polynomial of degree k is O(nk)
(Davi
Red-Black Trees
(David Luebke) Edited By
Usman Akram For CIIT
CS332:Algorithms
Review:BinarySearchTrees
key: an identifying field inducing a total ordering
left: pointer to a left child (may be NULL)
right: pointer to a right child (may be NULL)
p: pointe