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
Selection sort is a sorting algorithm, a comparison sort that works as follows:
1. find the minimum value in the list
2. swap it with the value in the first position
3. sort the remainder of the list (excluding the first value)
Example:
a=[9,7,5,3,1,0,4,6
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)
Queue
A data structure in which insertion is made from one end and
deletion from the other end is called queue
Or
A FIFO data structure is called queue
The end from which deletion is made is called Front End
The end from which insertion can be made is
Stack
A variable sized data structure in which insertion or deletion
is made just from one end
or
A LIFO data structure is called Stack
Operations on Stack
1) Push ( to insert an element into stack)
2) Pop( to take an element out of stack)
The last eleme
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
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
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
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
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
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
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