Free Essay

Mrs Priscilla

In:

Submitted By priscillas
Words 326
Pages 2
1. Algorithms A and B perform the same task. On input of size n, algorithm A executes 0.5n2 steps, and algorithm B executes 300n steps. Find the value of n above which algorithm B is more efficient. Show your work.

0.5n2 = 300n

=> n2 = 600n

=>n (n-600) = 0

Thus n = 0

=> n – 600 = 0

=>n = 600

To test which one is most effective plug in 601 in both equations

A = 0.5(601)2 = 0.5(361201) = 180600.5

B = 300(601) = 180300

Thus B is the most efficient

2. A long, long time ago, when I was in graduate school, I wrote a program to solve a difficult problem. The program had a time complexity of 2n(yeah, no kidding!). On input of size 50, my program finished in about an hour. How long would it have taken me to run my program on input of size 100?

If input of 50 takes 1hr in a time complexity of 2n It also takes 1 hour to execute and input of 100

3. Write an All-Pairs algorithm that is given a list of numbers and a target and outputs each pair of values that sum to the target. The two algorithms can work Algorithm 1: 1) Initialize Binary Hash Map M[] = {0, 0, …} 2) Do following for each element A[i] in A[] (a)If M[x - A[i]] is set then print the pair (A[i], x – A[i]) (b)Set M[A[i]] Algorithm 2:

1) Sort the array in non-decreasing order. 2) Initialize two index variables to find the candidate elements in the sorted array. (a) Initialize first to the leftmost index: l = 0 (b) Initialize second the rightmost index: r = ar_size-1 3) Loop while l < r. (a) If (A[l] + A[r] == sum) then return 1 (b) Else if( A[l] + A[r] < sum ) then l++ (c) Else r--
4) No candidates in whole array - return 0

Similar Documents

Free Essay

Ssadas

...Contact Information for Teaching Staff at Thomas Knyvett College If you email a member of staff please allow 48 hours for a response. If it is an urgent matter please contact a member of the SLT or your son/daughter’s House Leader. Senior Leadership Team Mrs Miss Mr Mr Mr Miss Mrs Mrs Mrs Miss Miss Mr Mrs Mrs Ms Mr Mrs Mrs Mrs Miss Miss Miss Miss Mrs Mr Miss Mrs Miss Miss Mr Ms Ms Mrs Mrs Miss Mrs Mrs Miss Mr Mrs Mr Mrs Mrs Miss Miss Miss Ms Miss Miss Miss Mrs Janise Farrah Andrew Sheldon Chris Freya Claire Valerie Inma Seema Allison Adam Sian Kapila Theresa David Aimi Correen Jackie Emma Tanya Joann Alison Rachel Nick Abigail Wendy Lauren Isobel Andy Megan Mazie Carolyn Priscilla Preetpal Gurinder Sian Emily Steven Christine David Susan Vanessa Hayley Jean Azmari Linda Laura Nicole Hayley Tanya Marillat Thantrey Ward Snashall Bellamy Oliver Parsons O’Keeffe Alvarez Balrai Bates Belbin Bolsh Chalisgaonkar Chambers Chapman Curtis Danks Dillaway Edge Ellis Epps Fairclough Foley Fowler Frith Grantham Jankowski John Knott Lister Lloyd-Smith Manwaring Naicker Nashad Oberai Reeve Razzell Ratsakatika Reilly Retsinas Rowntree Russell Sculpher Semadeni Shikder Strachan Thomas Vernon Warren Zaheer JMa FTh AWa SSn CBe FOL CPa VOk IAL SBa ABa ABe SBo KCh TCh DCh ACs CDa JDi EEd TEl JEp AFa RFo NFo AFr WGr LJa IJo AKn MLi MSm CMa PNa PNd GOi SRv ERa DRa CRe SRe SRe VRu HSc JSe ASh LSt LTh NVe HWa TZa Head of School Deputy Head Assistant Head Assistant Head Cross Phase Assistant Head Partnership...

Words: 591 - Pages: 3

Free Essay

Prescribed Drug Addiction

...Prescription Drug Abuse Interventions: Focus on Elvis Presley Alenka Ferrel, Jessica Garoutte, & Cristina Rainwater PSY 480 March 5, 2012 Dr. Tara Thompson Prescription Drug Abuse Interventions: Focus on Elvis Presley Prescription drug abuse is not currently classified by the DSM-IV-TR, for it focuses on a pattern of drug abuse which bypasses personality patterns and focuses on common characteristics between clients, rather than a specific drug (Meyer, Chapman, & Weaver, 2009). Prescription drug abuse is a wide-spread and exceedingly common problem in present day America. This essay will examine the case study of cultural icon Elvis Presley and his struggle with prescription drugs which eventually took his life. Biological, psychological, and social factors which contributed to his addiction will be examined, as well as interventions which may have been helpful had they been available or had Elvis decided to seek help. The examination of the case study, along with the contributing factors and possible interventions, should be considered for anyone going through problems with similar addictions. The Case of Elvis Presley Elvis Presley was one of the most well-known and famous individual’s of all time. After his death, Elvis was made into a cultural icon and coined the “King of Rock n’ Roll.” However, fame and fortune did not lead him down a productive and positive life path, but rather to a life of depression, alienation, and prescription drug addiction. Elvis...

Words: 1438 - Pages: 6

Free Essay

Hist 330

...Hutchinson was a midwife and the daughter of a preacher, she was was described as “a woman of haughty and fierce carriage, of a nimble wit and active spirit, and a very voluble tongue, more bold than a man…”(Reader, 5). She was a woman who challenged the idea that women were not allowed to voice their opinions about religion. Allegations of heresy were conducted against her after she was convicted of holding formal religious meetings in her home that also contested the status of women. While on trial she asked the court if there was a rule against her teaching since before she arrived there were such meetings previously held. She also gave an example of scripture giving them a reason why she has authority to teach stating, “Aquila and Priscilla, tooke upon them to instruct Apollo, yet he was a man of good parts…”(Reader, 6). The court responded by stating “I permit not a woman to teach…yet you shew us not a rule” (Reader, 6). She was found guilty of heresy for being a woman who challenged male authority and was finally banished from the colony. The trial...

Words: 446 - Pages: 2

Premium Essay

Search for Miss Ssg (Script)

...members and the spirited PTA Officers. J & M: ladies and gentlemen, good evening! Welcome to the search for MISS SSG 2011-2012 and the induction ceremony of Tugdan National High School. M: as we commence this momentous event, may I request everybody to rise for a soul warming doxology to be lead by selected students. J: please remain standing for the Philippine National Anthem to be conducted by Mrs. Rachel Fesalbon. M: the world is proud of having its great leaders. From ancient times up to present, good leaders foster the rest of the world to stand firm, to dream big and to take the highest flight man could ever take.. good leaders prepare people to survive the realities of life !ladies and gentlemen, let us hear from our loving Madam Melicia Galicia for her opening remarks. : and at this moment, may I call on Mr. Christian Solidum to introduce the board of judges for tonight’s affair. J: thank you sir! And now let us all welcome our candidates in their production number. J: now, we have the induction ceremony of the newly elected SSG Officers who will be presented by Mr. Randy A. Musa, SSG Adviser and to be inducted by Hon. Herman Galicia, ABC President.. may I request all the officers to come on stage. M: folks, let us be entertained as the selected students set on stage in their modern dance presentation. : thank you guys!! J: ladies and gentlemen, a big round of applause to the candidates in their fashionista...

Words: 790 - Pages: 4

Free Essay

Turn of the Screw

...home after the previous governess died. Douglas begins to read from the written record, and the story shifts to the governess’s point of view as she narrates her strange experience. The governess begins her story with her first day at Bly, the country home, where she meets Flora and a maid named Mrs. Grose. The governess is nervous but feels relieved by Flora’s beauty and charm. The next day she receives a letter from her employer, which contains a letter from Miles’s headmaster saying that Miles cannot return to school. The letter does not specify what Miles has done to deserve expulsion, and, alarmed, the governess questions Mrs. Grose about it. Mrs. Grose admits that Miles has on occasion been bad, but only in the ways boys ought to be. The governess is reassured as she drives to meet Miles. One evening, as the governess strolls around the grounds, she sees a strange man in a tower of the house and exchanges an intense stare with him. She says nothing to Mrs. Grose. Later, she catches the same man glaring into the dining-room window, and she rushes outside to investigate. The man is gone, and the governess looks into the window from outside. Her image in the window frightens Mrs. Grose, who has just walked into the room....

Words: 1066 - Pages: 5

Free Essay

The Star

...character? To what extent is her final protest justified? How do the other characters portray themselves by their attitudes toward the ritual? Mrs. Tess Hutchinson stands out right from the start: she arrives at the lottery late. She explains to Mr. Summers that she was doing her dishes and forgot what day it was. The town treats her lateness lightly, but several people comment on it, “in voices just loud enough to be heard across the crowd, ‘Here comes your Missus, Hutchinson,’ and ‘ Bill, she made it after all.’” (Jackson 501). It is ironic that she is the one who wins the lottery, and is fated to be stoned. So Tess Hutchinson has already been noticed by people as one who is not entirely part of the group. Before the drawing she is friendly with the other women, pretending to be pleased to be present. The very moment that she sees is her family that draws the black dot, though, her egotism is evident. “You didn’t give him time enough to take any paper he wanted. I saw you. It wasn’t fair!” (Jackson 504). She continues to scream about the unfairness of the ritual up until her stoning. Mrs. Hutchinson knew the lottery was wrong, but she never did anything about it. She pretends as much as she could to enjoy it, when she truly hated it all along. Maybe Jackson is suggesting that the more hypocritical one is, the more of a target they are. Mrs. Hutchinson was clearly the target of her fears. I think sometimes we have no problem remarking on people’s adultery until it is ourselves that...

Words: 548 - Pages: 3

Free Essay

Mr Ahmed

...May I beg that you will write at once to the mother of this unfortunate woman--to Mrs. Catherick--to ask for her testimony in support of the explanation which I have just offered to you?" I saw Miss Halcombe change colour, and look a little uneasy. Sir Percival's suggestion, politely as it was expressed, appeared to her, as it appeared to me, to point very delicately at the hesitation which her manner had betrayed a moment or two since. I hope, Sir Percival, you don't do me the injustice to suppose that I distrust you," she said quickly. "Certainly not, Miss Halcombe. I make my proposal purely as an act of attention to YOU. Will you excuse my obstinacy if I still venture to press it?" He walked to the writing-table as he spoke, drew a chair to it, and opened the paper case. "Let me beg you to write the note," he said, "as a favour to ME. It need not occupy you more than a few minutes. You have only to ask Mrs. Catherick two questions. First, if her daughter was placed in the Asylum with her knowledge and approval. Secondly, if the share I took in the matter was such as to merit the expression of her gratitude towards myself? Mr. Gilmore's mind is at ease on this unpleasant subject, and your mind is at ease—pray set my mind at ease also by writing the note." "You oblige me to grant your request, Sir Percival, when I would much rather refuse it." With those words Miss Halcombe rose from her place and went to the writing-table. Sir Percival thanked her, handed her a...

Words: 572 - Pages: 3

Premium Essay

The Virgin

...He went to where Miss Mijares sat, a tall, big man, walking with an economy of movement, graceful and light, a man who knew his body and used it well. He sat in the low chair worn decrepit by countless other interviewers and laid all ten fingerprints carefully on the edge of her desk. She pushed a sheet towards him, rolling a pencil along with it. While he read the question and wrote down his answers, she glanced at her watch and saw that it was ten. "I shall be coming back quickly," she said, speaking distinctly in the dialect (you were never sure about these people on their first visit, if they could speak English, or even write at all, the poor were always proud and to use the dialect with them was an act of charity), "you will wait for me." As she walked to the cafeteria, Miss Mijares thought how she could easily have said, Please wait for me, or will you wait for me? But years of working for the placement section had dulled the edges of her instinct for courtesy. She spoke now peremtorily, with an abruptness she knew annoyed the people about her. When she talked with the jobless across her desk, asking them the damning questions that completed their humiliation, watching pale tongues run over dry lips, dirt crusted handkerchiefs flutter in trembling hands, she was filled with an impatience she could not understand. Sign here, she had said thousands of times, pushing the familiar form across, her finger held to a line, feeling the impatience grow at sight of the man...

Words: 2581 - Pages: 11

Premium Essay

Missed Appt

...Article 86 of the Uniform Code Of Military Justice. This Article covers Point and Place of Duty. That means from PT formation to COB that is where you will be. What a lot of Soldiers do not understand that includes appointments made by them or someone else. We have appointment times, SP times, formation times and many other start times that dictate we will be there. If a Convoy has an SP time of fifteen hundred hours and the Soldiers decide to show up late because they did not feel like getting ready on time people could die. If they rolled out on time, they may have avoided the ambush or avoided the Vbid that hit them in the bottleneck. It sounds extreme but time management plays a critical role in the Army. When you make an appointment that spot has been reserved for you. That means if you have been given the last slot someone else is going to have to wait for another one to open up. This could be one day or one month. And because you missed it someone else is still going to have to wait when they could have had that spot and been there. If you are going to miss the appointment or cannot make it due to mission they do allow us to cancel the appointment with in twenty four hours. The Army allows us to make appointments for whatever we need. Be it for a medical appointment, house goods, CIF, Smoking Sensation or whatever we need these recourses are available to us. But when Soldiers start missing appointments theses systems start to become inefficient. What a lot of Soldiers do...

Words: 354 - Pages: 2

Free Essay

The Virgin

...THE VIRGIN by Kerima Polotan Tuvera 1) He went to where Miss Mijares sat, a tall, big man, walking with an economy of movement, graceful and light, a man who knew his body and used it well. He sat in the low chair worn decrepit by countless other interviewers and laid all ten fingerprints carefully on the edge of her desk. She pushed a sheet towards him, rolling a pencil along with it. While he read the question and wrote down his answers, she glanced at her watch and saw that it was ten. "I shall be coming back quickly," she said, speaking distinctly in the dialect (you were never sure about these people on their first visit, if they could speak English, or even write at all, the poor were always proud and to use the dialect with them was an act of charity), "you will wait for me." As she walked to the cafeteria, Miss Mijares thought how she could easily have said, Please wait for me, or will you wait for me? But years of working for the placement section had dulled the edges of her instinct for courtesy. She spoke now peremtorily, with an abruptness she knew annoyed the people about her. When she talked with the jobless across her desk, asking them the damning questions that completed their humiliation, watching pale tongues run over dry lips, dirt crusted handkerchiefs flutter in trembling hands, she was filled with an impatience she could not understand. Sign here, she had said thousands of times, pushing the familiar form across, her finger held to a line, feeling...

Words: 2588 - Pages: 11

Free Essay

Angelina Jolie

...was a member of the “Kissy girls”, whose job was to hunt boys down and kiss them till they screamed. Another hobby was to collect snakes and lizards. She even had a favourite lizard, called Vladimir. Later she was a student at Beverly Hills High School far from being beautiful. She wore braces, glasses and was painfully skinny. So the students teased her but they didn’t know that she had an impressive collection of knives. Her movie career At the age of seven she appeared in her first movie but her breakthrough came with Girl, Interrupted. It followed her big hit: her role in Tomb Raider, where she had to master a British accent. She had to become familiar with kick-boxing, street-fighting, yoga and ballet. In 2005 she released Mr. and Mrs. Smith, where she and Brad Pitt starred as a bored couple. Now she is married with Brad Pitt and although she is committed to motherhood she does charitable work...

Words: 269 - Pages: 2

Premium Essay

Angelina Jolie

...When most people see the name Angelina Jolie they only think of the talented actress, the significant other of Brad Pitt or the celebrity with the very diverse children but she is so much more than that. Since 2001 Jolie has been working alongside the United Nations High Commissioner for Refugees to bring awareness to the unfortunate situations of refugees from around the world. She has traveled to and volunteered in many third world countries such as; Sierra Leone, Cambodia, Costa Rica, Iraq and North Caucasus. In addition to this, she along with Brad Pitt founded the Jolie-Pitt foundation which is dedicated to eradicating extreme rural poverty, protecting natural resources and conserving wildlife. This foundation also donates to many other humanitarian groups, one being Doctors without Borders. In 2009 Angelina Jolie gave the opening speech for a World Refugee Day event being held at the National Geographic Society headquarters in Washington D.C. Throughout this speech Jolie concentrates not on the horrible conditions that refugees endure but on the spirit that they have from being in these situations. When speaking to millions of Americans she doesn’t rely on facts or statistics but instead she uses anecdotal evidence, visualization and pathos to get her point across. The purpose of this speech is not to persuade but to inform the people of America about the amazing people she has met while traveling to third world countries. Furthermore, she is trying to show people that...

Words: 268 - Pages: 2

Premium Essay

Pearls Paper

...When most people see the name Angelina Jolie they only think of the talented actress, the significant other of Brad Pitt or the celebrity with the very diverse children but she is so much more than that. Since 2001 Jolie has been working alongside the United Nations High Commissioner for Refugees to bring awareness to the unfortunate situations of refugees from around the world. She has traveled to and volunteered in many third world countries such as; Sierra Leone, Cambodia, Costa Rica, Iraq and North Caucasus. In addition to this, she along with Brad Pitt founded the Jolie-Pitt foundation which is dedicated to eradicating extreme rural poverty, protecting natural resources and conserving wildlife. This foundation also donates to many other humanitarian groups, one being Doctors without Borders. In 2009 Angelina Jolie gave the opening speech for a World Refugee Day event being held at the National Geographic Society headquarters in Washington D.C. Throughout this speech Jolie concentrates not on the horrible conditions that refugees endure but on the spirit that they have from being in these situations. When speaking to millions of Americans she doesn’t rely on facts or statistics but instead she uses anecdotal evidence, visualization and pathos to get her point across. The purpose of this speech is not to persuade but to inform the people of America about the amazing people she has met while traveling to third world countries. Furthermore, she is trying to show people that...

Words: 317 - Pages: 2

Free Essay

Caveat

...CAVEATS (To Prevent Registration of Dealings) Caveat is a Latin word meaning “Let him beware.” The Registration of Titles Act (RTA) contains provisions, Section 139, whereby any person claiming an interest or estate in land may lodge a caveat to protect his interest. The caveat is an injunction to the Registrar of Titles restraining the registration of any dealing affecting the ownership of the land without notifying the Caveator. A Caveat must be in substantial compliance with the RTA in order to be valid and is received by the Registrar. It is not an instrument and is not registrable. A party dealing with a registered proprietor will know of the caveat only from a search of the Certificate of Title from the Registrar. Caveator The name, address and description of the person who is claiming an interest in the land is required. Nature of the Estate or Interest Claimed The nature of the interest claimed should be clearly and concisely expressed. An equitable interest or estate without more detail is insufficient. The estate or interest claimed must be stated in the Caveat Form (see Thirteenth Schedule). In the absence of fraud (actual not constructive) all estates and interests in land prior to first registration are vitiated or extinguished with the exception of certain Crown rights and a tenant for a term not exceeding three years. Only a person having or claiming to have some recognized legal or equitable estate interest in land or a beneficiary can be a Caveator. The...

Words: 2395 - Pages: 10

Premium Essay

A Gabe of Sky

...A Gap of Sky A) In the short story “A Gap of Sky” we follow a young woman on her quest for the essence of life. Throughout the story, which stretches across an afternoon, she digs deeper into herself, through sleepiness, drugs, university and a general indifference towards life, until she sees herself, on a grey afternoon in the centre of London, “filled with something fizzing and alive and beautiful”. Ellie wakes up around 4 pm after a rough night with alcohol and various drugs that ended on a rooftop somewhere in London. She remembers that she felt happy that early morning, affected by the drugs and the surreal surroundings, but as she wakes up in her wretched little apartment, the joy of last night seems far away. She needs to hand in an essay on Virginia Wolf the next morning, so she rushes of to get some printer ink, cigarettes and possibly also some more coke. Ellie seems tired, worn out from last night and you understand that she has a hard time getting out of bed. You might get the impression that her life is a bit shallow, for instance when she tells that last night she was surrounded by people who laughed and had a good time, but now she is alone, coping with the harsh realities of a Monday morning. She seems tough, or wanting to seem tough, but she changes towards the end of the short story to a more real toughness of calm confidence. The core of Ellie's life isn't exactly to fulfil society's or her parent's wishes for a bright young woman. She has already had...

Words: 875 - Pages: 4