Free Essay

Essay on Gray Code

In:

Submitted By cartney
Words 797
Pages 4
Artificial Intelligence – Depth First Search(DFS)
November 13, 2012 · by Siddharth Agrawal · in Artificial Intelligence
Okay! So this is my first blog post!
I will start by talking about the most basic solution to search problems, which are an integral part of artificial intelligence.
What the hell are search problems?
In simple language, search problems consist of a graph, a starting node and a goal(also a node). Our aim while solving a search problem is to get a path from the starting node to the goal.
Consider the diagram below, we want to get to the node G starting from the node S.

Which path will we get on solving the search problem? How do we get the path? This is where algorithms come into picture and answer all our questions! We will look at Depth First Search which can be seen as a brute force method of solving a search problem.
Creating the search tree
So how do we simplify this problem? If we reduce the graph structure to a tree(not particularly a binary tree!), the problem would be to find a node with a particular value starting from the root.
So the tree would be as follows:
S will be the root of the tree. S will have children A and G. A will have children B and C. B will have only one child D. C will have children D and G. D will have only one child G.
Now you may ask which ‘D’ will have the child G, the one which is the child of B or the one which is a child of C? The answer is both. We want to consider all the possibilities and thus we have to show all the connections uniquely in the tree.
The diagram below shows the created search tree. Note that the nodes are alphabetically taken from left to right. This will be important later!
Also note that all the leaf nodes are G. This is not because G is the goal, but because there are no edges originating from G. Even if your goal was say D, the search tree would have remained the same.
Depth first search
Now solving the problem is just a matter of generalizing binary tree search to a tree which does not have a fixed number of children in each of its nodes. Depth First Search is quite similar to preorder traversal of a binary tree where you look at the left child, then the node itself and then the right child.
In Depth First Search, there is a priority queue where each element is a path from the root of the tree. The priority of an element is the number of nodes in the path. Higher the number, higher the priority. We use this priority queue in the following algorithm:
Insert the root node into the priority queue
While the queue is not empty Dequeue the element with highest priority (In case the priorities are same, the alphabetically smaller element is chosen) If the path is ending in the goal state, print the path and exit Else Insert all the children of the dequeued element, into the queue
Now let us apply the algorithm on the above tree and see what it gives us. We will write down the state of the priority queue at each iteration and look at the final output. Each element of the queue is written as [path,priority].
Initialization: { [ S , 1 ] }
Iteration1: { [ S->A , 2 ] , [ S->G , 2 ] }
Iteration2: { [ S->A->B , 3 ] , [ S->A->C , 3 ] , [ S->G , 2 ] }
Iteration3: { [ S->A->B->D , 4 ] , [ S->A->C , 3 ] , [ S->G , 2 ] }
Iteration4: { [ S->A->B->D->G , 5 ] , [ S->A->C , 3 ] , [ S->G , 2 ] }
Iteration5 gives the final output as S->A->B->D->G.
There are many things worth mentioning here:
-> The creation of the search tree is not a part of the algorithm. It is used only for visualization.
-> The algorithm returns the first possible path encountered, it does not search for all possible paths.
-> The returned path is the leftmost possible path in the search tree.
It searches deep into the leftmost branch first, and hence the name Depth First Search.
Because of the above properties, Depth First Search is not favored in not most cases. For example, if we need the shortest path Depth First Search won’t serve our purpose as it will return S->A->B->D->G instead of S->G. This is where Breadth First Search comes into picture. We shall see that in the next post!

Similar Documents

Premium Essay

Auditing

...Department of Law, Economics, Accountancy and Risk AUDITOR INDEPENDENCE Introduction The concept of independence is strongly associated with professionally standard auditing (Olagunju, 2011, pp.85). In other to maintain the utmost standard for the accounting profession, independence is seen as being free from control or pressure and not allowing situations which would tend to weaken objectivity or create personal preconceived notions (Porter and Simon et al., 1996). Audit improves the trustworthiness of the financial statements giving it sensible assertion from an independent source that the financial statements is true and fair in agreement with accounting standards (Olagunju, 2011, pp.85-86). The next section of this essay provides detailed information on how value is added to the financial statement when the auditors’ audit with independence whilst appraising how the accounting profession has or is reacting to auditor independence. While the last section will evaluate the risks or threats to independence and explain ways of mitigating identified risks. Value of Independent Auditing on Financial Statements The significance of audit services will be impaired when independence is absent (Sweeney, 1992); therefore, an uncompromised independence gives a better quality audit to the financial statements (Baber et al., 1995). In addition, if an auditor is independent, the motivation to do a better audit is not undermined as the auditor will report misstatements (Pike, 2003)...

Words: 2487 - Pages: 10

Free Essay

Term Paper

...| Bangl a) (Elements) ( Tag) ( Attributes) ( Paragraph) (Heading) (List) (Font) (Link) (Entity) (Comments) (Images) (Tables) (Colors) (Background) (Frame) (Layout) (Embed Music) (Vedio) (body) (Div) ( HTM Tut or i al i n L + + (Form) (Upload) : • Hypertext Markup Language. , । • • • । PHP+Database • Driven WebSite । । webcoachbd.com ( Notepad open Netbeans or Dreamweaver. • • • ) । (Elements) (Tag) (Attribute) >> ( HTM El em L ent s) : (Elements): (tag) page (Element) (closing tag) । HTML HTML Paragraph text, , HTML page Web elements (opening tag) , । 1.

- opening paragraph tag 2. Element Content - paragraph words 3.

- closing tag Web page (Element) elements । । : HTML,head, title body Element... HTML HTML । Welcome to Bangladesh Web page Notepad Open start All Programs > Accessories >Notepad Notepad 1. 2.Welcome to Bangladesh 3. less than greater than ( < >) : Welcome to Bangladesh । Notepad Web page Notepad Double click Page । save open । index.html Browser save open । web element head, elements element <head> closing() tag browser <head> elements header । head title elements । opening (<title>) 1.<html> 2.<head> 3.<title> My WebPage! 4. 5. element body element web page body element । 1. 2. 3.My WebPage! 4. 5. 6.Hello World! All my content goes here! 7. 8....

Words: 6504 - Pages: 27

Free Essay

What's Cohesion

...Language Professor Makhanlall What’s Cohesion? Paul Auster has a rather unique form of writing. Compared to other writers, Auster uses different techniques to draw his readers in. Auster’s use of cohesion, rhythm, and voice play unique roles in Auster’s City of Glass and Ghosts. Auster tends to do things in a very subtle and precise way, he never leads his reader astray and always leaves them wanting more. What interests me the most about Paul Auster’s writing is his use of cohesion (or lack there of). According to Martha Kolln and Loretta Gray in “Rhetorical Grammar:” “The first sentence in a paragraph, like the first paragraph of a chapter or an essay, sets up expectations in the reader about what is coming. Certainly one of those expectations is that the following sentences will stick to the topic. Another is that the sentence will have new information, not just a repeat of what the reader already knows.” (Kolln/Gray, pg. 87). This differs from what Auster does in City of Glass. Paul Auster draws his readers in by saying a little as possible until it is absolutely necessary; he is very literal with his language and does not give away information until it is essential. Firstly, Auster does not name his chapters, he simply numbers them. The beginning of chapter eight is a prime example of how Auster typically starts his chapters: “The next morning, and for many mornings to follow, Quinn posted himself on a bench in the middle of the traffic island on Broadway and...

Words: 970 - Pages: 4

Premium Essay

Ethical Issues

...Why are ethical issues a major concern in organization? When it comes to ethics I believe that it starts with ones morals, although morals are based on one beliefs and ethics is based on a code of conduct I believe you don’t have one without the other. So within any organization I believe that their goals is to insure that things are some right by ensure that the companies code of conduct is being consider when needed and applied. In our text on page 23 the authors does a great job of explaining ethics. They “say that ethics involves the study of moral issues and choices. It is concerned with right verse wrong, good verse bad and the many shades of gray in supposedly black and white issues.” Moral and ethical issues are in every one life on a daily bases, whether they are on the job or in their personal life. ((KInicki & Kreitner, 2009) I feel that it’s very important that a manager makes the right decision within an organization. If unethical behavior or code of conduct is present within an organization employees may feel that behavior is welcome and awarded. Subordinated would than lose respect for upper management within the organization. What individual influences impact ethical behavior? In our text the author teaches about the model of individual ethical behaviors and how a person has a unique set of personality characteristics, values, moral principles, history of reinforcement, and gender; meaning that people whom feel that they have higher morals tend to...

Words: 712 - Pages: 3

Free Essay

Ethical and Legal Issues in Pharamcy

...Ethical and Legal Issues in Pharmacy Name HCA322 Instructor December 16, 2013 Back in the 1990’s, the baby boomer generation stepped into their middle age years. Since it is not uncommon for people to begin having health issues at this age, there became a larger demand for healthcare services, and a huge demand for more prescription medications. The demand that was placed on the pharmaceutical industry brought about an urgent need for the teaching of professional ethics in schools of pharmacy. The measures taken in response to this demand were very necessary as the public now places such high expectations on pharmaceutical professionals, and rightfully so. They have access to both lifesaving and life-ending drugs and they possess knowledge that the common person finds intimidating. Patients feel a sense of vulnerability with all of the aspects involved with the industry that they may not understand such as the electronic transmission of information, electronic records, e-scripts, delivery and the complexity of health interventions, along with legal limitations, the many different medical specializations and the sharp rise in the use of generic pharmaceuticals (Klepser, et. al., 2008) It is possible that a pharmaceutical professional may find themselves in vulnerable positions as well, feeling trapped between their own personal ethics and the liabilities placed on them by their profession. They may find themselves sometime questioning as to whether they can fully uphold...

Words: 1701 - Pages: 7

Premium Essay

Tma1

...the two types of reflection are reflection in action and reflection on action. Reflection in action is the process of reflecting whilst completing a task whilst reflection on action is the process of reflecting on what you have done. This is an account of my learning experience, combining both approaches, whilst undertaking the mentorship course. The Gibbs model (1988) is a popular tool use to analyse and describe reflection. It is a cycle with six stages: description, feelings, evaluation, analysis, and conclusion and action plan. The rationale for using this model is because it is clear and precise. The essay will take into account my personal journey and the skills I am bringing to this course. Confidentiality will be maintained in accordance with the Nursing and Midwifery Council (NMC, 2008). Informed consent where necessary was also gained in accordance with the NMC Code (2008). Description I am currently working as a Registered Mental Health Nurse involved with patients with various challenges, and with staff at various stages of professional development. Learning and mentorship is an important activity in such an environment. Some of my colleagues had already completed their mentorship training and their recommendation of the course as taught in this University inspired me to apply. Furthermore, I enjoy teaching people and thinking about the challenges that come with it. Teaching people helps to develop my professional skills and knowledge including communication and...

Words: 1305 - Pages: 6

Free Essay

Anat Practices Notes

...UNIVERSITY OF SYDNEY. DEPARTMENT OF ANATOMY AND HISTOLOGY. ANAT 3008. MUSCULOSKELETAL ANATOMY. SEMESTER 2, 2011. COMMONWEALTH OF AUSTRALIA Copyright Regulation WARNING This material has been reproduced and communicated to you by or on behalf of the University of Sydney pursuant to Part VB of the Copyright Act 1968 (the Act). The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act. Do not remove this notice UNIT OF STUDY INFORMATION. UNIT OF STUDY CODE AND TITLE. ANAT 3008. Musculoskeletal Anatomy. UNIT OF STUDY DESCRIPTION AND GOALS. The unit of study is available in semester two of year three in medical science and science degrees and is worth six credit points. The unit provides an opportunity for students to study the macroscopic topographical and systems anatomy of the limbs. The curriculum varies from year to year and other regions and topics are introduced. Emphasis is placed upon the identification and description of structures, the correlation of structure with function and the use of anatomical knowledge in understanding or solving problems in other disciplines. Particular emphasis is given to the innervation of the limbs. The unit also aims to develop the general skills of observation, description, drawing, writing and discussion as they apply to biological structures. The unit builds upon...

Words: 1895 - Pages: 8

Premium Essay

Expository Essay

...Expository Essay October-2-2011 Expository Essay Joe Chernov, public relations executive whose arms are inked from wrists to biceps with Asian-themed tattoos, applied for a position at a conservative company, where he was given a chance for an interview. Upon this interview he decided to wear a long cuffed shirt which he usually would not wear as it ended up showing part of his tattoo on his wrist. He didn’t get the job even though he was more than qualified for the position he had applied for, it could be questioned if the tattoos had anything to do with this decision made by the interviewing company (Pyrillis, 2010). Although people have tattoos and body piercings in a workplace their performance while working should matter not their appearance. With that in mind it can be viewed that tattoos and body piercings in a workplace or during a hiring process can make speculations of unfair judgment against potential employees, since it can be argued that the interviewer bases their opinion of the candidate with the tattoos or piercings work off of their appearance versus their work history, performance, and work ethics. Many persons feel as though it is necessary to cover up any tattoos or piercings while in their workplace. One example would be a survey of two thousand twenty people was taken where sixty eight percent of men and seventy two percent of women felt it necessary to cover up their tattoos and/or piercings in the workplace (Pyrillis...

Words: 1603 - Pages: 7

Premium Essay

Would the New Statutory Framework Cover Social and Environmental Reporting Area?

...responsibility also embraces the social and environmental reporting practices on the basis of the personal judgement (Deegan and Unerman, 2006, pp. 318). Social and environment reporting can be defined as the process of the communication with particular stakeholder groups within society regarding the social and environmental impacts of the organisation (Gray, Owen and Maunders, 1987, pp. ix). It has been argued that the accounting standards which deal with this social and environmental sector appear to be somewhat meagre although there are some frameworks in terms of sustainability reporting (Gray et al, 1997). Hence, there may be some claims that an accounting standard regarding social and environmental issues needs to be established while others might think that the organisation may feel more comfortable to comply with current guideline from the association 'Global Reporting Initiative (GRI)' for sustainability reporting (Deegan and Unerman, 2011, pp. 389). It is thought that accounting standard should not address the social and environmental part because a number of organisations currently follow frameworks with respect to this area (Gray et al,...

Words: 3915 - Pages: 16

Free Essay

Ethics

...CFO does not agree to correct the financial statements B. The CEO supports the CFO and does not agree to correct the financial statements C. The external auditors support the CEO and do not agree to correct the financial statements D. The audit committee should always be the first to be informed about such a difference of opinion   4. An internal accountant should always take the following step after exhausting all avenues of appeal within the organization when there is a difference of opinion with top management on an accounting or financial reporting matter:  A. Inform the SEC B. Terminate employment with the entity C. Seek legal advice before taking any action D. All of the above 5. The Public Interest Principle in the AICPA Code of Professional Conduct recognizes:  A. The importance of integrity in decision making B. The primacy of stakeholder groups C....

Words: 2936 - Pages: 12

Free Essay

Hospital Scenario

...HCA-24 Contempory Issues in Healthcare America is facing a shortage; a shortage of Physician’s. “The Council of Graduate Medical Education released a report predicting a shortage of about 85,000 physicians by 2020.” (Cross, 2007) With the start of Affordable Health Care and the increase in the aging population there are just not enough providers to go around. In this essay we will discuss how the shortage affects healthcare from a business aspect; how non-profit and profit organizations impacted, what the responsibilities of the management staff is, and what rules and standards the financial management must address with this problem. In, the end we may not have a answer to this problem but we will have a better understanding of what the financial management must juggle in order to run a successful department or organization. The shortage of physicians is likely going to affect every aspect of healthcare. Profit and Nonprofit organization will both be affected some ways similar and in some ways different. Not-for-profit organizations, “are owned by the entire community rather than by investor-owners,” and profit organizations, “earn profits that are distributed t the investor-owners of the firms or reinvested in the firm for the long term benefit of these owners.” (Cleverly, 2011, pg. 8) The Affordable Health Care System has made a large impact on how organizations are reimbursed which is the major interest to both organizations. The shortage comes at a bad time...

Words: 1118 - Pages: 5

Premium Essay

It Project Management

...Development) BSc/BSc (Hons) Information Technology Management for Business BSc (Hons) Computer Games (Design) BSc/BSc (Hons) Cyber Security and Networks BSc/BSc (Hons) Networked Systems Engineering IT PROJECT MANAGEMENT 1 module code M3G405252 MODULE HANDBOOK – TRIMESTER A SESSION 2015/2016 Module Code: M3G405252 Module Title: IT PROJECT MANAGEMENT 1 Standard Module Abbreviation: ITPM1 Module Level: 3 Credit Points: 20 Module Leader: Edwin Gray, Office: M609, email:e.gray@gcu.ac.uk September 2015 Issue 1 01/09/2015 Edwin M Gray, BA, MSc, MBCS, CITP, CPSSADM Contents Page 1 Introduction 3 2 Module Overview 3 3 Module Descriptor 4 4 Module Assessment 7 5 Feedback 10 6 Indicative Reading 10 7 The Library, Saltire Centre 11 8 Learning Material Supplied By Module Leader 12 9 Module Delivery Structure 12 10 Learning and Teaching Plan 14 M3G405252 IT PROJECT MANAGEMENT 1 INTRODUCTION This handbook gives details of the module content, teaching schedule, recommended reading, assessment and feedback strategies used for students undertaking the module IT Project Management 1 (M3G405252 (old code: COMU350) Module Leader contact details: Eddie Gray, M609, (e.gray@gcu.ac.uk) Programmes Taking This Module This module’s host programmes are: • P01627 BSc/BSc (Hons) Computing (Information Systems Development) • P00249 BSc /BSc (Hons) Computing (Web Systems Development) ...

Words: 3307 - Pages: 14

Premium Essay

Death Penalty

...ways. Whenever the word "death penalty" comes up, extremists from both sides start yelling out their arguments. One side says deterrence, the other side says there's a potential of executing an innocent person; one says justice, retribution, and punishment; the other side says execution is murder. Regardless of people’s philosophic points of view, it is important to be aware of the facts. This is exactly what I would like to talk about in this essay: the facts regarding this controversial issue. I do not have the answer to this question; I believe both viewpoints have good arguments. Everyone is entitled to his or her own opinion in this or any other matter, but no one is entitled to his own facts. What is the death penalty? Congress or any state legislature may prescribe the death penalty, also known as capital punishment, for murder and other capital crimes. (Death Penalty: An Overview, 2010) As far back as the Ancient Laws of China, the death penalty has been established as a punishment for crimes. In the 18th Century BC, the Code of King Hammurabi of Babylon established the death penalty for twenty five different crimes, although murder was not one of them. The first death sentence historically recorded occurred in 16th Century BC Egypt where the wrongdoer, a member of nobility, was accused of magic, and ordered to take his own life. During this period non-nobility was usually killed with an ax. (Reggio, M. 2005) The first recorded execution in the English American colonies...

Words: 2381 - Pages: 10

Free Essay

Management

...Course: MGT. 304 Advanced Business Communication | Instructor: Mr. Charlie E. Hardy | Course Credit Hours 3 | Instructor’s Office: 311-A Business Administration | Instructor’s Office Hours: MW 9:00-11:00-3:00-4:00-T 3:00-5:00-R 9:00-11:00 | Instructor’s Email Address: chardy@alasu.edu | Instructor’s Office Phone: (334)229-5066 | Prerequisites: All courses in sequence prior to this course including: ENG... 131, ENG... 132, MGT. 204 | MISSION STATEMENT The mission of the College of Business Administration is to train its students to become ethical entrepreneurs and professionals capable of succeeding in a competitive global environment. DEADLINE FOR COURSE WITHDRAWAL: The last day for withdrawal is stipulated in the official semester’s Schedule. The deadline for withdrawal from a course for the Fall 2011 semester is Thursday, October 13, 2011 COURSE DESCRIPTION POLICIES ADA Accommodation & Alternative Testing Under ADA, any student requiring alternative formats for testing and/or handouts for this course, or other types of accommodation, due to a handicapping condition, should advise the instructor within the first week of classes and must present the appropriate documentation Attendance, Exam & Assignment Makeup Policy UNIVERSITY ATTENDANCE POLICY Effective Fall Semester 2009 Each student is expected to attend all lectures, seminars, laboratories and field work for each registered class, including the first class session, in order to verify...

Words: 3382 - Pages: 14

Premium Essay

Mentorship

...Contents Introduction ………………………………………………………………….Pages 2-3 Discussion…...…………………………………………………………………Pages 4-14 Conclusion …………………………………………………………………...Pages 15-16 References ………………………………………………………………….Pages 17-20 Introduction This essay aims to explore the processes of teaching, training and mentoring of adults. The setting in which this will be explored and linked to, will be one of nursing, although it is recognised that the fundamental theories explored may be applied to any setting where the teaching, training and mentoring of adults occur. The essay will explore the writer’s understanding regarding the role of a mentor within the workplace and the theoretical ties surrounding mentorship and how these are linked into the writer’s role of a mentor. Any names or areas of work mentioned in the essay have been changed in order to maintain confidentiality, clause five of the Nursing and Midwifery Council (NMC) Code of Professional Conduct: Standards for Conduct, Performance and Ethics (NMC 2004). The term ‘mentor’ is defined by the English National Board (ENB) and the Department of Health (DOH) to “denote the role of the nurse, midwife or health visitor who facilitates learning and supervises and assesses students in their practice setting” (ENB & DOH 2001a P6). Nicklin and Kenworthy (2000) define a mentor as someone who by example and facilitation guides, assists, and supports the student in learning new skills, adopting new behaviour and acquiring...

Words: 4754 - Pages: 20