English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

All categories - 5 February 2007

Arts & Humanities · Beauty & Style · Business & Finance · Cars & Transportation · Computers & Internet · Consumer Electronics · Dining Out · Education & Reference · Entertainment & Music · Environment · Family & Relationships · Food & Drink · Games & Recreation · Health · Home & Garden · Local Businesses · News & Events · Pets · Politics & Government · Pregnancy & Parenting · Science & Mathematics · Social Science · Society & Culture · Sports · Travel

A majority element is an element that appears more that n/2 times.

My initial throught was to:
My inittial Running time would be O(n^n), because it needs to touch each element once for each element. Is there a better algorithm for my problem?

Step 1: Start with the first element. (Take every unique element) in the sorted array and count how many times each occurs.
Step 2: Store a count. If the count of another unique element is greater that count. Store that element and its count.
Step3: After traversing the entire list, compare count to n/2. If count is larger that n/2, there exists a majority element.

Example:

1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 7, 9, 10

**Stored Element = Stored count**

1 = 1
2 = 1
3 = 1
4 = 1
5 = 9
6 = 1
7 = 2
9 = 1
10 = 1

After traversing, 5 = 9. Is count > n/2?

9 > 16/2, Yes. Therefore there is a majority element.

2007-02-05 07:30:22 · 5 answers · asked by roberto1502 1 in Programming & Design

After a couple of comments made about my body by the guy I'm dating I now find myself being more critical of my body. I worry about changing or gaining weight or even someday having a kid because of small things being said even though he's more careful now. We've talked about it and I will think I'm okay but later I hear things come out of my mouth about my weight or body that never used to (and it's not like I'm overweight or that I worried before). Can I continue dating him if I'm still having problems with it? What should I do?

2007-02-05 07:30:19 · 4 answers · asked by DebChick 1 in Singles & Dating

my mom, and both of her sisters are bipolar. i think ive been in denial about it, but im starting to think that i am as well. this terrifies me, because my mom is a whack job and i want to be nothing like her. mood swings, yes deffinitley have those, but those of you who are bipolar, or have loved ones that are, what are personality traits of you/them? how do you/they cope?

2007-02-05 07:30:13 · 10 answers · asked by *never give up* 4 in Mental Health

They didnt deserve to be there. Not with their cream-puff schedule.
Their schedule will be off the charts hard next year, and they wont even go .500.
You heard it here 1st.

2007-02-05 07:30:12 · 8 answers · asked by JusticeManEsq 5 in Football (American)

please tell me, what are the unique agricultural products of USA. For example- sandal wood of india,

2007-02-05 07:30:10 · 1 answers · asked by johnvarghesep 1 in Economics

Nate Robinson, Gerald Green (Boston), Orlando’s Dwight Howard and Chicago’s Tyrus Thomas. To me, I think its gonna be one of the worst contest. But my money is on Green. Nate shouldn't have won last year, Andre should've won it. Dwight Howard WHY is he in it. All he does is one and two hand jams. I don't see no creativity in him. Tyrus, in LSU he did his thing.

Gerald Green, James White, Tyrus and Andre should be in it.

2007-02-05 07:30:09 · 14 answers · asked by Jamie A 3 in Basketball

This is a reply to a posted video that someone watched but its in another language and I don't know what it means. The name of the one who replied is Pti' Lao.

2007-02-05 07:30:06 · 2 answers · asked by dtamada 1 in Languages

All items must go...all cheap yard sale
http://millsberry.com/yard_sale.phtml?cit=bestfriendsjessie10

2007-02-05 07:30:05 · 3 answers · asked by t_cell68 1 in Other - Games & Recreation

is there a way i can get hold of free online academic journals on forensic psychology?
im doing a reasearch paper for an undergrad degree in criminology
thanks:)

2007-02-05 07:30:02 · 1 answers · asked by Lara^mt 5 in Psychology

christians need to drop the whole "taking out of context" argument? its obvious they dont even bother opening their bible to read the surrounding text when they use this argument. i think its about time they come up with a new way to "beat around the bush" and avoid a potential debate with another meaningless statement.

2007-02-05 07:30:01 · 15 answers · asked by Anonymous in Religion & Spirituality

Have anxiety or panic attacks about a big life changing decision you have to make, and whether or not you made the right or wrong decision? I made a big decision and I know it's right, and it's what I want, but every now and then, I panic, and worry if it's really the right thing to do or not, but ultimately I know and feel it is.

2007-02-05 07:30:00 · 5 answers · asked by precious 3 in Psychology

or Mummy and Mummy, should Fathers be shagging their own Daughters so they can be picked up from school by their Father and their Grandfather at the same time?

2007-02-05 07:29:58 · 13 answers · asked by Anonymous in Government

What dose the following mean: (I am doing an expierement of magnets under heat regaurding to their preformance)

-Hypothesis
-Varibles
-Controls
-Procedures

Thanks!

2007-02-05 07:29:53 · 2 answers · asked by Anonymous in Physics

should I have clocked him one

2007-02-05 07:29:47 · 18 answers · asked by Anonymous in Friends

"A Modest Proposal" by Jonathon Swift

2007-02-05 07:29:39 · 4 answers · asked by lilbigred12 2 in Homework Help

I just wrote two separate CDs with the same information on both of them from a Dell desktop computer with Windows XP, using the Windows CD-RW writing program (where you drag whatever you want into the file area and then finalize the CD). When I tried to use either of these CDs in my IBM Thinkpad laptop w/ XP, the D: (CD) drive comes open but the "CD" shows up blank. When I put them in the F: (CD) drive of my Dell they show up fine.


What is the problem and is there any way for me to fix it?

They both have XP home edition.

2007-02-05 07:29:39 · 4 answers · asked by Jayna 2 in Software

2007-02-05 07:29:37 · 16 answers · asked by allan p 1 in Law & Ethics

I Click the lock button but I can not figure out how to arm it. It never makes the arming noise and the red light on the mirror does not flash. What do I have to do?

2007-02-05 07:29:34 · 5 answers · asked by Ryan R 1 in BMW

Which one is better

2007-02-05 07:29:34 · 6 answers · asked by Anonymous in Military

I may be moving to the Philadelphia area and want to know what areas in or near Philly are good for raising children (safe, good schools, etc.). What are the more expensive neighborhoods or suburbs (not that I'll necessarily be able to afford to live there, but I'd like to have an idea of what the best places are to live)?

2007-02-05 07:29:30 · 6 answers · asked by crabbyone 5 in Family

Hi, my friend came to the US 10 years ago (1997). He is permanent resident and stayed in the US for about 4 to 5 years. He went back to his original country for a year and half. He came back to the US 2 years ago (Sep/04).

Now he wants to file the citizenship. He heard that one of the requirements is that he has to stay in the country continuously for at least 5 years. Since he left the county for more than 1 year, the time before he left won't be counted in the 5 years period. Is it correct?

Does he have to wait for another 5 years (from Sep/04 onward) to send the application? Can he do that earlier? Also, usually how long it takes for all the procedures until he gets the citizenship?

Thank you.

2007-02-05 07:29:27 · 5 answers · asked by tckww2000 1 in Immigration

2007-02-05 07:29:26 · 14 answers · asked by hansombynature 1 in Heart Diseases

My girlfriend broke up with me last night. I tried to act like it didn't bother her. After breaking up with me she called me and told me she was sad and things were going to be odd without me in her life. This morning she called me and told me she wanted me back. I said OK i wanted to work it out as well. But today she seems so depressed. I text her today while i was at work she replied with an "I'm having a bad day can't talk" I I called her 3 times before she actually picked up and she told me she couldn't talk. I asked her to talk to me for five seconds and she just told me about how bad her day was. Then she told me she had to run because she has grocery shopping to do and errands to run for her mother who is sick with the flu. I said fine. She's acting VERY ODD to towards me today almost like she's not interested in me. We both have off Wednesday from our usually hectic schedule and i asked her if she would like to get coffee she said "No thanks." WHAT IS GOING ON?? I'M CONFUSED!

2007-02-05 07:29:26 · 24 answers · asked by Mark 1 in Singles & Dating

a generic pain killer don't know the correct spelling

2007-02-05 07:29:25 · 1 answers · asked by Donna B 1 in Pain & Pain Management

My grandmother died about 3 weeks ago. We were very close. I am still having problems controlling my grief. How long is normal for this to occur?

2007-02-05 07:29:24 · 4 answers · asked by nikkawho 1 in Psychology

We have all been taught that sound waves cannot travel in a vacuum, so there would be no sound in a place with no atmosphere, like the moon. On earth, our atmosphere or what we commonly call "air" is made up of a mixture of several gasses in specific proportions. Sound waves travel through air and we detect them through our sense of hearing.
If we were on another planet with an atmosphere, such as Mars or Jupiter, the gasses making up their atmospheres are very different from ours. Would sound pass through these alien atmospheres, and if so would the sound heard by a person be sensed as the same sound as caused by the identical event on earth?

2007-02-05 07:29:23 · 9 answers · asked by fg 2 in Astronomy & Space

2007-02-05 07:29:18 · 12 answers · asked by TennisGrl 2 in Movies

Ok I work with this guy I like. (Please dont answer with its a bad idea) Anyway whenever theres a lot of us together, I am the first one he talks to. Hes shy but we can talk for hours if we wanted to. When he talks to me, he stands really close to me, closer then to others. His arms arent crossed and his body and feet are facing me. He does look me in the eyes when he talks to me. He jokes around me a lot and I have caught him staring at me a couple times. I might have to make the first move because he is shy and I am 20 and he is 18. Do you think he likes me?

2007-02-05 07:29:10 · 11 answers · asked by Anonymous in Singles & Dating

fedest.com, questions and answers