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

  • 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

    The first network topology is hierarchical star, also known as the tree topology. This topology has different levels. The top level is the ‘root’ node; it serves as the central connection to the next level of computers. Then the second levels of computers serves as a connection to the third level of computers so on and so forth for the rest of the computers.…

    • 545 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    It302-Unit4

    • 648 Words
    • 3 Pages

    My first idea was to create a dashboard that was focused mainly Xeno Sales overall profit. This was a simple dashboard which was to show the user exactly how much profit or loss the Xeno Sales Company has for the year on a monthly basis. This dashboard would only have a couple of graphs that displayed the monthly profits throughout the year so the user can distinguish trends or trouble months. My second idea is a dashboard which focused on both Xeno Sales overall profit and the individual stores and their corresponding areas sales and expenditures. This is a complex dashboard which would provide the user with everything they would want to know as far as profit margins are concerned. This dashboard would consist of customizable graphs which can display the monthly sales, expenditures, the overall profit, the expected profit, and the average profit growth.…

    • 648 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    IT113 Unit 5

    • 393 Words
    • 2 Pages

    • Planning the forest and domain structure should include a checklist that can be referenced for…

    • 393 Words
    • 2 Pages
    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
  • 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
  • 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
  • Powerful Essays

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

    • 2985 Words
    • 12 Pages
    Powerful Essays

Related Topics