Preview

it422-hw2-sol

Good Essays
Open Document
Open Document
814 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
it422-hw2-sol
King Saud University
College of Computer and Information Sciences
Information Technology Department
IT327
Artificial Intelligence

Homework 2 search strategies
Q1.
A. Show that DFS generates about O(bm) nodes in the search tree. m: The maximum length of any path in the state space b: The branching factor: maximum number of successors of any node.
At the worst case, DFS generates about O(bm) nodes in the search tree. As follows :
At m (max depth )tries : 1 +b + b2 + b3 +….+ bm =O(bm) , the graph below illustrates this.

B. Explain why DFS requires less memory than BFS.
In BFS you keep all nodes in memory, so the complexity is O(b^[d+1]) which is the number of generated nodes (or O(b^[d+1])). In BFS time complexity = memory complexity.
For DFS you only keep the path to the current node in memory and potentially all its the successors of those nodes, so its O(bm).
Where : b: The branching factor: maximum number of successors of any node. d: The depth of the shallowest goal node. m: The maximum length of any path in the state space.

Q2.
A. Starting from “a”, find the goal “e” using DFS with tree-search algorithm, and then with graph-search algorithm.

You have to show:
1. The search tree.
2. The order in which nodes will be visited.
3. The fringe at each step.
4. The closed set (in case of graph-search only).
5. The solution path.
6. The fringe (and closed set) after the search is terminated.
Note: expand nodes in alphabetical order when you have more than one candidate for expansion.
Using Graph search algorithm:
Order of node visited : a , b, a, c, a, b, e.
Closed List: a , b, c.
Solution Path : a , b , c, e.
Final fringe : c, d.

Using Tree search algorithm:
Order of node visited : a0 , b1, a2, b3, a4, b5, …….
Note : ni means : n is a node, and i is depth of node n.
Result: infinite tree, the goal will not be reached, because we cannot rid from repeated states.
Final fringe : infinite

You May Also Find These Documents Helpful

  • Good Essays

    Between two nodes in a network there can be many connecting paths but usually shortest path is considered best. It means any information exchange between two nodes also go through all nodes appearing in shortest path. By this reason any node involved in shortest paths can have…

    • 596 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    13. Which one of the following OSPF neighbor states is the expected state after completion of the…

    • 901 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    Consequently, if the advantage of A against the proposed scheme is ϵ, the success probability of the algorithm C against the DDH challenge is at least ϵ/(e(m!q_T+1)).…

    • 111 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    Fi 320 Hw 2

    • 679 Words
    • 3 Pages

    #1. Billy’s Exterminators, Inc., has sales of $643,000, costs of $280,000, depreciation expense of $32,000, interest expense of $26,000, and a tax rate of 35 percent. What is the net income for this firm?…

    • 679 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Nt1310 Unit 1 Test Paper

    • 381 Words
    • 2 Pages

    3. Create a binary search function that tells whether a given value exists in the tree or not.…

    • 381 Words
    • 2 Pages
    Good Essays
  • Better Essays

    As this is a directed graph, some nodes might not have edges directed to it(in-degree) or directed from it(out-degree).Here in-degree means the number of votes the node received and out-degree is the number he voted for other node. Through NodeXL, we found the nodes with zero in-degree and zero out-degree. This can be done by NodeXL. In the excel sheet NodeXL menu ,…

    • 1080 Words
    • 5 Pages
    Better Essays
  • Good Essays

    Parallel Arrays

    • 427 Words
    • 2 Pages

    Key in saving wasted memory. The nodes of a linked data structure can also be moved individually to different locations without affecting the logical connections between them, unlike arrays. With due care, a process can add or delete nodes to one part of a data structure even while other processes are working on other parts. On the other hand, access to any particular node in a linked data structure requires following a chain of references that stored in it. If the structure has n nodes, and each node contains at most b links, there will be some nodes that cannot be reached in less than log b n steps. For many structures, some nodes may require worst case up to n -1 steps.…

    • 427 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Algorithms Test

    • 640 Words
    • 3 Pages

    1- Depth-first search always expands at least as many nodes as A* search with an admissible heuristic…

    • 640 Words
    • 3 Pages
    Good Essays
  • Better Essays

    [2] Ben Pfaff , “An Introduction to Binary Search Trees and Balanced Trees”, Stanford University, Computer Science Dept. 2002.…

    • 2558 Words
    • 11 Pages
    Better Essays
  • Satisfactory Essays

    Breath First Search

    • 538 Words
    • 3 Pages

    readth First Search (BFS) searches breadth-wise in the problem space. Breadth-First search is like traversing a tree where each node is a state which may a be a potential candidate for solution. Breadth first search expands nodes from the root of the tree and then generates one level of the tree at a time until a solution is found. It is very easily implemented by maintaining a queue of nodes. Initially the queue contains just the root. In each iteration, node at the head of the queue is removed and then expanded. The generated child nodes are then added to the tail of the queue.…

    • 538 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Using fragmentation in DCF did not affect the load much and it remains nearly the same. However, using PCF resulted in load drop and when we used fragmentation with PCF the load decreased even more.…

    • 536 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Binary Tree

    • 4816 Words
    • 20 Pages

    A binary tree is made of nodes, where each node contains a "left" pointer, a "right" pointer, and a data element. The "root" pointer points to the topmost node in the tree. The left and right pointers recursively point to smaller "subtrees" on either side. A null pointer represents a binary tree with no elements -- the empty tree. The formal recursive…

    • 4816 Words
    • 20 Pages
    Powerful Essays
  • Powerful Essays

    The concept of a zerotree is introduced which identifies the parts of a tree that…

    • 2985 Words
    • 12 Pages
    Powerful Essays
  • Good Essays

    CS457 E HW8

    • 849 Words
    • 4 Pages

    As) The rollup, cube operators are extension of group by clause. The rollup, cube operators can generate the same result set as when you use UNION ALL to combine single grouping queries, however using one of the group by clause operators like rollup, cube, and grouping sets is usually more efficient. These operators don’t support the CHECK SUM _AGG function.…

    • 849 Words
    • 4 Pages
    Good Essays
  • Better Essays

    Master Theorem

    • 5125 Words
    • 21 Pages

    These behaviors depended upon whether a < 2, a = 2, and a > 2. Remember that a was the number of subproblems into which our problem was divided. Dividing by 2 cut our problem size in half each time, and the n term said that after we completed our recursive work, we had n additional units of work to do for a problem of size n. There is no reason that the amount of additional work required by each subproblem needs to be the size of the subproblem. In many applications it will be something else, and so in Theorem 5.1 we consider a more general case. Similarly, the sizes of the subproblems don’t have to be 1/2 the size of the parent problem. We then get the following theorem, our first version of a theorem called the Master Theorem. (Later on we will develop some stronger forms of this theorem.) Theorem 5.1 Let a be an integer greater than or equal 1. Let c be a positive real number and d a nonnegative form aT (n/b) + nc T (n) = d then for n a power of b, 1. if logb a < c, T (n) = Θ(nc ), 2. if logb a = c, T (n) = Θ(nc log n), 3. if logb a > c, T (n) = Θ(nlogb a ). Proof: In this proof, we will set d = 1, so that the bottom level of the tree is equally well computed by the recursive step as by the base case. It is straightforward to extend the proof for the case when d = 1. Let’s think about the recursion tree for this recurrence. There will be logb n levels. At each level, the number of subproblems will be multiplied by a, and so the number of subproblems at level i will be ai . Each subproblem at level i is a problem of size (n/bi ). A subproblem of size n/bi requires (n/bi )c additional work and since there are ai problems on level i, the total number of units of work on level i is ai (n/bi )c = nc ai bci = nc a bc…

    • 5125 Words
    • 21 Pages
    Better Essays

Related Topics