×
Log in to StudySoup
Get Full Access to Introduction To Algorithms - 3 Edition - Chapter 15 - Problem 15-5
Join StudySoup for FREE
Get Full Access to Introduction To Algorithms - 3 Edition - Chapter 15 - Problem 15-5

Already have an account? Login here
×
Reset your password

Edit distance In order to transform one source string of

Introduction to Algorithms | 3rd Edition | ISBN: 9780262033848 | Authors: Thomas H. Cormen ISBN: 9780262033848 130

Solution for problem 15-5 Chapter 15

Introduction to Algorithms | 3rd Edition

  • Textbook Solutions
  • 2901 Step-by-step solutions solved by professors and subject experts
  • Get 24/7 help from StudySoup virtual teaching assistants
Introduction to Algorithms | 3rd Edition | ISBN: 9780262033848 | Authors: Thomas H. Cormen

Introduction to Algorithms | 3rd Edition

4 5 1 244 Reviews
30
3
Problem 15-5

Edit distance In order to transform one source string of text x1 : : m to a target string y1 : : n, we can perform various transformation operations. Our goal is, given x and y, to produce a series of transformations that change x to y. We use an array assumed to be large enough to hold all the characters it will needto hold the intermediate results. Initially, is empty, and at termination, we should have j D yj for j D 1; 2; : : : ; n. We maintain current indices i into x and j into , and the operations are allowed to alter and these indices. Initially, i D j D 1. We are required to examine every character in x during the transformation, which means that at the end of the sequence of transformation operations, we must have i D m C 1. We may choose from among six transformation operations: Copy a character from x to by setting j D xi and then incrementing both i and j . This operation examines xi. Replace a character from x by another character c, by setting j D c, and then incrementing both i and j . This operation examines xi. Delete a character from x by incrementing i but leaving j alone. This operation examines xi. Insert the character c into by setting j D c and then incrementing j , but leaving i alone. This operation examines no characters of x. Twiddle (i.e., exchange) the next two characters by copying them from x to but in the opposite order; we do so by setting j D xi C 1 and j C 1 D xi and then setting i D i C 2 and j D j C 2. This operation examines xi and xi C 1. Kill the remainder of x by setting i D m C 1. This operation examines all characters in x that have not yet been examined. This operation, if performed, must be the final operation. for Chapter 15 407 As an example, one way to transform the source string algorithm to the target string altruistic is to use the following sequence of operations, where the underlined characters are xi and j after the operation: Operation x initial strings algorithm copy algorithm a copy algorithm al replace by t algorithm alt delete algorithm alt copy algorithm altr insert u algorithm altru insert i algorithm altrui insert s algorithm altruis twiddle algorithm altruisti insert c algorithm altruistic kill algorithm altruistic Note that there are several other sequences of transformation operations that transform algorithm to altruistic. Each of the transformation operations has an associated cost. The cost of an operation depends on the specific application, but we assume that each operations cost is a constant that is known to us. We also assume that the individual costs of the copy and replace operations are less than the combined costs of the delete and insert operations; otherwise, the copy and replace operations would not be used. The cost of a given sequence of transformation operations is the sum of the costs of the individual operations in the sequence. For the sequence above, the cost of transforming algorithm to altruistic is .3 cost.copy// C cost.replace/ C cost.delete/ C .4 cost.insert// C cost.twiddle/ C cost.kill/ : a. Given two sequences x1 : : m and y1 : : n and set of transformation-operation costs, the edit distance from x to y is the cost of the least expensive operation sequence that transforms x to y. Describe a dynamic-programming algorithm that finds the edit distance from x1 : : m to y1 : : n and prints an optimal operation sequence. Analyze the running time and space requirements of your algorithm. The edit-distance problem generalizes the problem of aligning two DNA sequences (see, for example, Setubal and Meidanis [310, Section 3.2]). There are several methods for measuring the similarity of two DNA sequences by aligning them. One such method to align two sequences x and y consists of inserting spaces at 408 Chapter 15 Dynamic Programming arbitrary locations in the two sequences (including at either end) so that the resulting sequences x0 and y0 have the same length but do not have a space in the same position (i.e., for no position j are both x0 j and y0 j a space). Then we assign a score to each position. Position j receives a score as follows: C1 if x0 j D y0 j and neither is a space, 1 if x0 j y0 j and neither is a space, 2 if either x0 j or y0 j is a space. The score for the alignment is the sum of the scores of the individual positions. For example, given the sequences x D GATCGGCAT and y D CAATGTGAATC, one alignment is G ATCG GCAT CAAT GTGAATC -*++*+*+-++* A + under a position indicates a score of C1 for that position, a - indicates a score of 1, and a * indicates a score of 2, so that this alignment has a total score of 6 1 2 1 4 2 D 4. b. Explain how to cast the problem of finding an optimal alignment as an edit distance problem using a subset of the transformation operations copy, replace, delete, insert, twiddle, and kill. 15-6 Plannin

Step-by-Step Solution:
Step 1 of 3

PSYC 160 C HAPTER EIGHT Intelligence Intelligence Being able to understand the world, think rationally, and use resources effectively IQ Test Tests a person’s mental and chronological age. Stanford Binet Intelligence Scale Measures age and what a person should know at a given age a.k.a. “mental age” Wechsler Intelligence Scale Test for children that measure verbal and nonverbal skills Kaufman Assessment Battery Children are tested on their ability to step-by-step think and differentiate between stimuli Bayley Scales Infant (2 months – 2.5 years) testing Crystallized Intelligence The accumulation of facts, information , and knowledge that comes with education and experience Fluid Intelligence Made up of reasoning, abstract thinking, and speed of processing. More likely to decline as we age Howard Gardner (1943 - ) American developmental psychologist that believed intelligence tests were far too narrow. Instead, he thought we have multiple intelligences independent from one another. Eight Categories of Intelligence Music, interpersonal and intrapersonal skills, nature, kinesthetic, spatial, linguistic, logic and math skills Daniel Goleman (1946 - ) American psychologist associated with emotional intelligence, which is a combination of interpersonal and intrapersonal skills Interpersonal Skills Understanding the behavior of those around you Intrapersonal Skills Understanding what pushes your buttons Emotional Intelligence The ability to perceive and express emotions, adapt and understand, and manage your emotions Arthur Jensen (1923 – 2012) Professor of educational psychology that focused on how the environment affects intelligence Environment Studies a. Found that identical twins IQs become similar as they age and the opposite is found in fraternal twins b. Identical twins had more similar IQ PSYC 160 scores than fraternal twins, even when the identical twins were raised apart c. Adopted kids IQ scores more closely resembled biological parents more than adopted parents d. Children that grow up with biological family have an average IQ of 109 Abecedarian Project A longitudinal study with over 100 participants from low income, poorly educated families that looked at the role of the environment on intelligence. Consisted of an intervention and control group Intervention Group Received full-time, year round child care as well as medical and social benefits. Kids in the intervention group had an average IQ score of 101, which is 17 points higher than the control group Control Group Received only medical and social benefits The Bell Curve (1994) Controversial book written by Charles Murray and Richard Herrnstein that argued that Caucasian intelligence is superior to African American, b/c the underclass are intellectually deprived, so they commit crime Criticism of The Bell Curve a. Did not take in to account social and educational opportunities for African Americans b. The intellectual gap between Caucasian and African Americans is narrowing c. No evidence that proves low IQs cause crime Stereotype Threat Situational threat that confirm group stereotypes, like Asians being smart Intellectual Disability (Mental Below average intelligence (IQ of 70 or Retardation) lower) that makes it difficult to adapt to everyday life and is present before age 18. 4 Levels of MR Mild, moderate, severe, profound Mild MR IQ within 50s – 70 range. Often a low level worker Moderate MR 35 – 50s range. Still able to work but nndd assistance. Can’t function past a 2 grade level PSYC 160 Severe MR 20 – 34 range. Often can’t take care of themselves Profound MR Below 25. Not able to function and need 24/7 care Gifted and Talented Kids Having a high IQ or showing special abilities that are valued in our society. Studies find these kids are healthier, better coordinated, and psychologically better adjusted CHAPTER N INE Social and Emotional Development Attachment Close, emotional, and positive bond between parent and child that’s present around 6-7 months The Strange Situation Created by Mary Ainsworth, which evokes an infant’s reaction to mom (or dad) under stressful conditions. Consists of 8 episodes The Eight Episodes 1. The mom and child are brought in to a room 2. The baby is free to explore their surroundings 3. A stranger comes in to the room and talks to the mom and child 4. The mom leaves the room and the stranger stays in the room 5. The mom returns and the stranger leaves 6. The mom leaves again and the child is alone 7. The stranger returns 8. The mom returns and the stranger leaves Different Levels of Attachment Secure, avoidant, ambivalent, disorganized-disoriented Secure Attachment Mom is a secure base for the child and are happy when she’s present and upset when she leaves Avoidant Attachment Child does not interact with their mother. Exhibits little stress when she leaves and avoid her when she returns Ambivalent Attachment Child becomes distressed when mom leaves, but refuses to be comforted by mom when she returns Disorganized-disoriented Attachment Children show inconsistent and contradictory behavior. Often found to PSYC 160 be abused Disengagement Theory Theory with little support that claims older adults will psychologically, physically and emotionally slow down Socioemotional Selectivity Theory As you enter late adulthood, you become more content in life, b/c they are spending time with people they like, which reduces emotional risk Activity Theory Maintaining interests in activities that we did in middle age will promote successful aging. Continuity Theory Do as we always did in order to stay happy, like working out or doing nothing T/F Our emotional state becomes more False. Older adults are usually happy negative as we age. and believe they have earned retirement Personality The combination of characteristics or qualities that form an individual's distinctive character Traits Personality characteristics that lead us to interpret events in a way that is our own The Big Five A set of 5 broad trait factors that describe basic personality. They’re genetically influenced, show up early in life, and is found in most cultures What are the big five personality traits Openness, conscientiousness, extraversion, agreeableness, neuroticism Openness Curious vs. interest Conscientiousness Organized, deliberate vs. lacking seriousness Extraversion Introverted vs. extroverted Agreeableness Kind, helpful, open vs. cynical, suspicious Neuroticism Anxious, moody vs. stable C HAPTER ELEVEN Moral Development and Aggression Moral Development Changes in people’s idea of what is right and wrong and their behavior towards moral issues Jean Piaget Swiss psychologist known for his theory of moral development Lawrence Kohlberg (1927 – 1987) American psychologist that built on Piaget’s work. Believed moral PSYC 160 development is in stages and universal Three stages of moral reasoning Preconventional, conventional, postconventional Preconventional Morality People follow rigid rules based on punishments and rewards; 2 stages 1. Punishment and obedience orientation 2. Reward orientation Conventional Morality People approach moral problems as members of society; 2 stages 1. Good boy morality 2. Authority and social order maintaining morality Postconventional Morality People use moral principles that are seen as broader than those of any particular society; most people do not reach this level; 2 stages 1. Morality of contract, individual rights, and democratically accepted law 2. Morality of individual principles and conscience Criticism of Kohlberg’s Theory a. Reflected western society b. Focused on male participants c. Overemphasized rational thought and didn’t take in account religious beliefs Parenting Styles Authoritarian, Permissive, Authoritative, Neglectful Authoritarian Parents who are strict, controlling, set limits to a fault, and have little verbal exchange Permissive Parents who are lax, inconsistent, and have few demands for their kids Authoritative Parents who are encouraging, clear, and communicate well with their kids Neglectful or Uninvolved Parents who show little interest in their children PSYC 160 Emotion Dismissing Approach Childs emotions are dismissed or ignored Emotion Coaching Approach Parent monitors child’s emotions and teaches them what that emotion is Does spanking stunt a child’s Yes, physical discipline affects brain intellectual growth development. Types of Child Abuse Physical, emotional, sexual, neglect Physical Abuse Use of physical force (i.e. kicking, punching, etc.) that may result in bodily injury or harm Emotional (Verbal) Abuse A form of abuse characterized by a person subjecting another to behavior that may result in psychological trauma. Kids emotionally abused are 12x more likely to end up schizophrenic than general population Sexual Abuse Forcing undesired sexual behavior on another person Neglect Failing to provide a child’s basic needs, such as shelter, clothing, food, and school Abuse Statistics a. 33% of abused people will abuse their own kids b. 1/4 of marriages experience spousal abuse c. 50% of murdered women are killed by their partner d. Globally, 1 out of 3 women are victims of violence e. In the U.S., 5 kids are killed each day from child abuse f. Over 3 million kids are abused and/or neglected in the U.S. Factors of Delinquency Kids growing up in poverty, joining a gang to gain status and avoid being beaten, lack of family support system, knowing where you’re kids are at all times, inconsistent and inappropriate use of punishment increase delinquency, no father figure Rape Sexual assault perpetrated against a person without that person's consent and often goes unreported Rape Statistics a. According to the CDC, 1 out of every 5 females aged 12+ is raped in the U.S. b. Only 14% of rapes against women are perpetrated by a stranger PSYC 160 c. 15% of rapes against men are perpetrated by a stranger d. Rape results in about 32,000 pregnancies each year e. Partner rape results in 20% of pregnancies f. Recent research has found that almost 13,000 rape kits sat around for 10 years untested g. 2/3 of college men admit to forcing sexual penetration on females Prosocial Behavior Positive behavior intended to benefit others Altruism Unselfish regard for or devotion to the welfare of others. Purest form of prosocial behavior Antisocial Personality Disorder A mental health disorder characterized by disregard for other people Oppositional Defiant Disorder A child marked by defiant and disobedient behavior to authority figures Conduct Disorder A range of antisocial types of behavior displayed in childhood or adolescence. More commonly seen in males Serial Killer A person who murders three or more people, with the murders taking place over more than a month and including a significant break between them 3 Common Characteristics in Serial 1. Animal abuse Killers 2. Set fires 3. Enuresis (bedwetting) Types of Serial Killer Visionary, missionary, hedonistic, power oriented Visionary Kill as they’re commanded by controlling voices. Ex. David Berkowitz killed people because his neighbor’s dog told him to Missionary Understand they’re the chosen exterminators and target elderly, non- heterosexual, etc. Hedonistic Act based on thrill value alone; kill for tangible reasons. Ex. Bundy, Dahmer, Gacy killed for sexual gratification Power or Control Oriented Killer Pleasure from asserting power over victim. Ex. Hannibal Lector Elizabeth Bathory (1560 – 1614) Hungarian Countess known for being the most prolific serial killer of all time, PSYC 160 killing over 600 women Pedophile Information a. Male pedophiles may develop fixation on kids due to stunted physical growth early in life or in the womb b. Male pedophiles are about 1 inch shorter than other males c. Pattern of malnourishment, infections, or exposure to toxins in childhood leads to stunted growth d. Neurodevelopmental disease found in most pedophiles

Step 2 of 3

Chapter 15, Problem 15-5 is Solved
Step 3 of 3

Textbook: Introduction to Algorithms
Edition: 3
Author: Thomas H. Cormen
ISBN: 9780262033848

Other solutions

People also purchased

Related chapters

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

Edit distance In order to transform one source string of