Jump to content

Wikipedia:Reference desk/Archives/Science/2006 July 2

From Wikipedia, the free encyclopedia
Humanities Science Mathematics Computing/IT Language Miscellaneous Archives
The page you are currently viewing is an archive page. Whilst you can leave answers for any questions shown below, please ask new questions at one of the pages linked to above. This will insure that your question is answered more quickly.

< July 1 Science desk archive July 3 >


Palm Beetles vs Cock Roaches

[edit]

I live in the Cochella Valley in California. We have thousands of Palm Trees. We frquently see large, brown bugs that I think are cockroaches but other people say they are Palm Beetles. Can anybody tell me if those two different creatures are so similar that they could be confused. The ones I see are 1-2 inches in length, reddish brown. They seem to be ubiquitous in this area.

I live in South Carolina. We have cockroaches and palmetto bugs. I assume that your palm beetles are our palmetto bugs. The big difference: palmetto bugs can fly. Other than that, they are both roaches. --Kainaw (talk) 00:43, 2 July 2006 (UTC)[reply]
The American cockroach is also known as a palmetto bug and it can fly.
I tried searching for "palm beetles," but all I can find are palm-boring beetles. --Kjoonlee 08:09, 2 July 2006 (UTC)[reply]

If it is a beetle, it will probably have a hard, opaque pair of forewings. See Beetle. BenC7 02:55, 5 July 2006 (UTC)[reply]

Rate of fall and heat

[edit]

Why does a feather fall as teh same rate as a lead orb? I know air resistance kicks in for the feather, but if we exclude that, what is actually happening to the falls?

Also, why does everything radiates heat without necessary moving?

Your second question might be answered by Thermal radiation. As for the first, could you clarify what you mean by excluding air resistance? Do you mean, perhaps, why they fall at the same rate in a vacuum? Melchoir 02:42, 2 July 2006 (UTC)[reply]
(after edit conflict)
For motion (an object falling), you should read Newton's laws of motion, especially the second law: The rate of change of the momentum of a body is directly proportional to the net force acting on it. Note: it does not include the weight/mass of the body, just the force acting on it. Gravity is gravity. It doesn't matter if the body is a feather or lead orb. Of course, air resistance acts in opposition to gravity on a feather, so that would slow the fall of the feather. However, in a vacuum, the feather and lead orb fall at the same rate.
For the second question, "everything" doesn't radiate "heat". However, "most things" radiate some form of "electromagnetic radiation". It is a byproduct of the conservation of energy. What you see as heat is just a long chain reaction of chemical processes all acting and reacting to one another. --Kainaw (talk) 02:43, 2 July 2006 (UTC)[reply]
Your assertion that force does not include the mass of the object being acted upon is incorrect. The acceleration of the object is inversely proportional to its mass—the less an object weighs the greater its acceleration for a given force. Gravity (as we experience it on Earth) works as basically a constant accleration to objects, independent of their mass. Consequently, the force due to gravity, which we call weight, is greater for more massive objects—this is how a spring scale works. The real equation can be found in the gravity article. Note that the mass of the Earth and the distance between the centers of mass is in the equation, but that works out to be a constant in our experience as their Earth is so massive and so spherical. The lead weight and the feather, even though they have different masses, experience the same accelerations independent of their mass. When you bring in air resistance, you have to calculate the sum of the forces acting on the bodies and force due to gravity is greater for the heavier object and it falls faster even if the objects have the same aerodynamics. —Bradley 06:49, 3 July 2006 (UTC)[reply]
Thanks. Next time I see Newton, I'll tell him his second law of motion is wrong. --Kainaw (talk) 13:16, 3 July 2006 (UTC)[reply]
As you quote, Newton's second law refers to the momentum of the object. We understand momentum as being composed of the mass of the object and its velocity or are you making some pedantic argument as to the composition of spacetime? —Bradley 19:59, 3 July 2006 (UTC)[reply]
Please feel free to change Newton's second law. You'll probably win a Nobel. He was obviously wrong when he stated: "The rate of change of the momentum of a body is directly proportional to the net force acting on it, and the direction of the change in momentum takes place in the direction of the net force." Apparently, he should have said, "The rate of change of the momentum of a body is directly proportional to the net force acting on it and inversly proportional to the mass of the body." Therefore, a lead orb will fall faster than a feather in a vacuum because a lead orb has more mass. Right? Or - does Newton's second law omit the mass of the body as a cause of change? No, that can't be it. --Kainaw (talk) 00:03, 4 July 2006 (UTC)[reply]
Newton's second law doesn't mention gravity. Gravity does not apply the same force to the lead as it does to the feather. Gravity applies the same acceleration to each object. Force and acceleration are different, but they are related to each other by a factor, which is... wait for it... MASS. If you apply the same force to each object, their momentums will change exactly as Newton describes in his second law, but the heavier object will be accelerated to a lesser degree and its velocity will then, consequently, change to a lesser degree.
An example: if a 5 N force is applied to a 10 kg object, it will undergo an acceleration of 0.5 m/s². If a 5 N force is applied to a 1 kg object, it will undergo an acceleration of 5 m/s².
The mass of an object is why when you push a car it doesn't move as quickly as when you push a bike for the same expenditure of force. You apparently think mass is a useless and antiquated phenomenon—perhaps you were hit in the head with a feather. —Bradley 16:40, 5 July 2006 (UTC)[reply]
(after another edit conflict)
While you are waiting for someone to answer the first question try reading Black body to get an answer to your second question. ...IMHO (Talk) 02:46, 2 July 2006 (UTC)[reply]

Regarding your first question, if you drop a lead ball and a feather in a vacuum container (ie with no air or gas in it), both objects would fall at exactly the same rate. - Cybergoth 01:09, 3 July 2006 (UTC)[reply]

And this experiment (with a feather and a hammer being dropped) was performed by the astronauts of Apollo 15 on the Moon. You can download the video from NASA, which is highly recommended, since it's trippy as all hell to watch. --ByeByeBaby 11:41, 4 July 2006 (UTC)[reply]
It's pretty easy to simulate on Earth as well. Get a piece of tissue paper and two books of equal weight and dimensions.
  • Drop the two books at the same time.
  • Drop one book and one piece of tissue at the same time.
  • Put the tissue on top of one book, and drop the book.
How fast did the tissue fall in the third case? As fast as the book. --Kjoonlee 15:11, 5 July 2006 (UTC)[reply]

oh, I think you should all stop fucking around with Newtons laws. from what I remember, his second law (simplified) means that an object needs a certain amount of speed and acceleration to move it depending on its mass.

I'm wondering if anyone knows exactly why root bear floats foam so much. On Talk:Root beer float, there are a few statements saying that it is because of the yucca extract added to the root beer. But what I'm wondering is why the foaming is exacerbated in the presence of Ice Cream. I would naturally assume that there is some kind of chemical reaction between the Ice Cream and some specific ingredient in the root beer, possibly the yucca, or something else. Just as an example, I can pour about 10 oz of root beer into a 16 oz (approximately) glass before the foam runs over the top. When I add even a teaspoon of ice cream however, I can only pour in about 2 oz of root beer before I have foam all over the place. Can anyone elaborate?

First, note that the yucca extract is a foaming agent - added specifically to create foam. Initially, root beer meant "sasparilla root beer". I believe the FDA labeled sasparilla root a carcinogen. So, yucca was used as a replacement. Now, on to ice cream. Cream has a lot of protein in it. Also, it normally has some sort of gumming agent to make it sticky. Both of those lower the surface tension of the root beer. With lower surface tension, the carbonation escapes easier. When carbonation escapes, the foaming agent foams. So, adding ice cream makes it easier for root beer to foam. --Kainaw (talk) 03:42, 2 July 2006 (UTC)[reply]
Yucca is present only as a foaming agent. Sasparilla in root beer was replaced by artificial flavoring. Rmhermen 21:31, 5 July 2006 (UTC)[reply]
I would also imagine that the protein in the cream acts to stabilise the foam that is produced (you know that when you add icecream the foam/scum stays), so the foam will build up higher as it isn't popping as quickly. I don't know exactly why proteins such as that found in cream act to stabilise foams, but they do. Someone probably has an answer. Skittle 15:49, 2 July 2006 (UTC)[reply]
Thanks for the info. I was going to ask about that next. I too noticed that the foam tends to stay around longer with the Ice Cream and it's is usually somewhat sticky and gummy after it dries up a bit so I was guessing that this had something to do with the proteins or the gumming agent becoming incorporated into the foam. -- Nebular110 17:14, 2 July 2006 (UTC) (sorry, forgot to sign the original question)[reply]
Also note that microscopic bubbles act as "nucleation sites" for forming visible bubbles ...and ice cream contains zillions of bubbles. If you pour root beer into milk, you only get brown milk. But if you pour rootbeer onto ice cream, you get a gigantic explosion of foam. (Also try pouring rootbeer into whipped cream. Same effect: the microscopic bubbles in the whipped cream create a huge foam blast.) --Wjbeaty 01:50, 4 July 2006 (UTC)[reply]
This description is a physical process and should not be confused with a chemical reaction which it is not. Rmhermen 21:31, 5 July 2006 (UTC)[reply]

Enlarged stomach lymph nodes

[edit]

What is the cause of enlarged abdominal, right side, lymph nodes? What can it be?

Lymphadenopathy has an almost countless number of causes. It's not clear what you mean by abdominal lymph nodes (intra-abdominal nodes would be detected on CT scan or MRI or other imaging: could you mean inguinal nodes?) In any case, no one here can tell you the cause of any particular person's lymphadenopathy; that person needs to find out the likely causes from their physician. There are lots of factors to consider, including the person's age, the size and texture and appearance of the nodes, medical history, etc. - Nunh-huh 03:59, 2 July 2006 (UTC)[reply]
As always, you should first speak to a licensed medical professional, and you should NOT use any other source such as this reference desk as a primary source of information about your health. That being said, the article on lymph nodes describes how lymph nodes can become enlarged during the immune response to an infection. But are you sure (i assume you're talking about yourself here) that you're feeling your 'lymph node' on your stomach? I don't think they're very big... perhaps it's something else? --Bmk 04:03, 2 July 2006 (UTC)[reply]

Simple carbohydrates

[edit]

I'm trying to list all the molecules with formula CnH2nOn and figure out what they're like, e.g. what would happen to you if you ate them. The only CH2O is formaldehyde, a well known poison. For C2H4O2, there's acetic acid, well known as vinegar, and another one, which I kept searching for by the names of 2-hydroxyacetaldehyde, 2-hydroxyethanal, 2-oxoethanol, and even 1,2-ethenediol (its tautomer), but after a while I figured out it's called glycolaldehyde. So, we have an article on it, but it's not very good, and doesn't answer my questions. What would happen to you if you drank glycolaldehyde? (I assume it's a liquid because it forms hydrogen bonds like ethanol.) Does it taste sweet? Is it poisonous? —Keenan Pepper 05:18, 2 July 2006 (UTC)[reply]

The only other C2H4O2 isomer I can think of is methyl formate, which isn't too good for you. Have I missed any? —Keenan Pepper 05:41, 2 July 2006 (UTC)[reply]

Formaldehyde doesn't follow the structure CnH2nO2. The last one has an extra oxygen atom. - Mgm|(talk) 08:12, 3 July 2006 (UTC)[reply]
I assume he meant CnH2nOn (and have changed it accordingly above). —Ilmari Karonen (talk) 15:18, 3 July 2006 (UTC)[reply]
Interesting topic. I assume you're not counting tautomers; otherwise you'd be including 1,1-ethenediol as well (and counting both cis and trans forms of 1,2-ethendiol). The only other thing I can think of is to ditch the double bond and use a ring. I have no idea how stable they'd be, but if cyclobutane's stable, maybe these would be too. My organic chemistry's far too rusty to permit guessing at the nomenclature, but something like -CH2-O-CH2-O- (ends joined to make a ring) might be possible. — Knowledge Seeker 06:20, 2 July 2006 (UTC)[reply]
The IUPAC name would be 1,3-dioxacyclobutane, and apparently it's also called 1,3-dioxetane. —Keenan Pepper 15:41, 2 July 2006 (UTC)[reply]
1,1-ethenediol would be the enol form of acetic acid (and also the hydrate of ketene). I rather doubt it's particularly stable. Google suggests it does occur an an intermediate in some reactions. —Ilmari Karonen (talk) 15:18, 3 July 2006 (UTC)[reply]
Glycoaldehyde is very poisonous. It is the metabolite of ethylene glycol that leads to the latter's toxicity. The treatment of anti-freeze poisoning is to prevent the formation of glycoaldehyde by supplying an alternative substrate for alcohol dehydrogenase, saturating the enzyme using either ethanol or fomepizole. If you drank glycoaldehyde there is no treatment other than dialysis that would stop the toxicity. --Seejyb Oops, that's glycolaldehyde --Seejyb 21:11, 2 July 2006 (UTC)[reply]
Thanks. So wait... if you accidentally drink antifreeze, you're less likely to get poisoned if you drink a lot of booze afterwards? =P —Keenan Pepper 23:09, 2 July 2006 (UTC)[reply]
yep, thats even a medically recognised treatment for ethylene glycol poisioning. although they inject it iv so you don't have a choice of flavour... (http://www.aafp.org/afp/20020901/807.html) Xcomradex 04:08, 3 July 2006 (UTC)[reply]
If you're interested, ethanol treatment is also standard for methanol poisoning. TenOfAllTrades(talk) 16:11, 3 July 2006 (UTC)[reply]
If we're talking rings (which we should, since that's how most typical carbohydrates often exist), how about 1,2-dioxacyclobutane (dioxetane) for C2H4O2? I'm not sure if that specific compound is known experimentally, but compounds containing a -C-C-O-O- ring are, and are the basis for chemiluminescence. DMacks 05:12, 6 July 2006 (UTC)[reply]

Nuclear Reaction

[edit]

When a nuclear bomb is set off how much of its mass is turned into light?

Depends on the size doesnt it. Philc TECI 12:03, 2 July 2006 (UTC)[reply]
No, it doesn't: it's apparently a percentage of the overall energetic output. Philc, effects of nuclear explosions may be a good page for you. Happy reading! – ClockworkSoul 14:09, 2 July 2006 (UTC)[reply]
The amount of light depends on what kind of bomb, what materials are in it and how enriched they are, and mass. — The Mac Davis] ⌇☢ ญƛ. 15:43, 2 July 2006 (UTC)[reply]

Is there a way to make a nuclear explosion 100 percent effecent. For example no radiation and all the mass being directly converted into energy as light or heat?

No, there isn't. When a neutron strikes a uranium-235 or plutonium-239 atom, gamma photons will always be released. Energy is also released in the form of kinetic energy--from the fission products, the neutrinos, and the neutrons. (Light, by the way, is radiation.) --Bowlhover 17:32, 2 July 2006 (UTC)[reply]
I think the original asker could benefit from reading over the article on nuclear fission. However, the question is valid - how much of the mass of the original uranium is turned into EM energy? In the 'average' fission reaction (there are many possible paths for a U-235 fission), around 21 MeV of energy are released in the form of gamma rays [1] Now we can pull out or handy E=mc2 calculator, and find that the rest mass of U-235 in MeV is about 220 GeV. Therefore just about about 0.01% of the energy in a U235 fission event is converted to light. Of course, the temperatures generated in the shockwave convert a lot more energy into light, but that's way harder to calculate. Also, as someone mentioned above, a nuclear bomb is not 100% efficient, but it's around that figure for the entire mass of the uranium. --Bmk 20:22, 2 July 2006 (UTC)[reply]
Bmk, why is a nuclear bomb around 100% efficient? The person who asked whether a 100%-efficient bomb is possible, defined efficient as "no [non-light] radiation and all the mass being directly converted into energy as light or heat". Nuclear bombs produce much less light and heat than they do gamma rays, so they're no where near 100% efficient.
That said, I think that an efficient nuclear bomb should be one does the most destruction per gram of mass. This depends mostly on how much fission/fusion material is in the bomb, and how much of that material actually undergoes fission/fusion before the bomb is destroyed. (In the bombs dropped on Japan in 1945, for example, only 1.4% and 14% of the uranium/plutonium in the bombs actually underwent fission.) --Bowlhover 01:25, 3 July 2006 (UTC)[reply]
Bowlhover - sorry - this was an error of poor wording. What I meant to say was "a nuclear bomb does not use 100% of the mass of uranium it started with, but probably nearly 100%, so the percent of Uranium mass turned into gamma rays for the entire bomb is still nearly 0.01%. Sorry for the confusion --Bmk 21:02, 3 July 2006 (UTC)[reply]
Changing the subject, Bmk found out that 0.01% of an uranium-235 atom's mass is converted into gamma rays, but how much of the mass is converted into visible light? We cannot see gamma rays, so they can't be considered as light. --Bowlhover 01:25, 3 July 2006 (UTC)[reply]
It is not the U-235 that is being converted into energy, it is just the binding energy which gets released during the fission. I think people get this pretty confused. When U-235 fissions it turns into a two fission products, a few neutrons, and some gamma rays. If you add up the mass in all of the constituent components, you'll find it is slightly less than it was when they were together; the "missing mass" here is the mass which has been turned into energy. This is explained at our article on E=mc2. Efficiency in bomb design is calculated by how much of it material fissions, not how much of it is converted into energy (they are not unrelated numbers, but the percentages are very different—a bomb in which 20% of the material fissions is not the same thing as saying that 20% of it is converted into energy). --Fastfission 01:16, 3 July 2006 (UTC)[reply]
True, but since the mass attributable to binding energy in U-235 IS part of the mass of the U-235, it is still appropriate to calculate the amount of mass which has been transformed into electromagnetic radiation. The original question had nothing to do with bomb efficiency, just the amount of mass changed into light. And for those who disputed the usage of light, I was using it to refer to any EM radiation, but i concede that 'light' technically only refers to that in the visible spectrum. If the original question was meant to refer only to visible light, then I have no idea what the answer is - i think you'd just have to take measurements during an actual explosion. The thermodynamics are probably too difficult to address analytically. --Bmk 21:06, 3 July 2006 (UTC)[reply]

Thank You all for your answers as far as 100 percent efficent nuclear bomb I am actually talking about the reaction I strongly disagree with the use of nuclear technology in wepons.

Stupid question

[edit]

Can/will anyone recommend (free and win32) tools for backing up CD/DVDs as ISO's, authoring CD/DVDs, and mounting ISOs as virtual drives?--Frenchman113 on wheels! 13:50, 2 July 2006 (UTC)[reply]

Alcohol 120%? Philc TECI 13:52, 2 July 2006 (UTC)[reply]
not free?--Frenchman113 on wheels! 14:28, 2 July 2006 (UTC)[reply]

May be I should have made this more clear. They don't have to be one program. I'm looking for a set of utilities that does the above.--Frenchman113 on wheels! 14:30, 2 July 2006 (UTC)[reply]

Daemon tools I got for free, that mounts all image files (.ISOs .bins etc) Philc TECI 14:52, 2 July 2006 (UTC)[reply]
Alcohol 120% is free if you use BitTorrent. — The Mac Davis] ⌇☢ ญƛ. 15:42, 2 July 2006 (UTC)[reply]
Well, two things. The cracks don't seem to work. It's easy to get a virus this way. And I have dial-up, so no BT.--Frenchman113 on wheels! 16:20, 2 July 2006 (UTC)[reply]

All this leaves is a good program to generate ISOs. After a lot of googling, I still can't find one that's both free and win32. I've got CDBurnerXP Pro for burning and DAEMON Tools for mounting images. Unfortunately, neither one can create ISO images.--Frenchman113 on wheels! 20:37, 2 July 2006 (UTC)[reply]

If you need it for a one-off, just get Alcohol 120 trial version. Philc TECI 21:11, 2 July 2006 (UTC)[reply]
DeepBurner (Free version now at v1.7?). From the help file: "If you want to create an ISO image, choose "Create data CD/DVD" after you start the program, then click next. In the next window choose "No multisession" and click "next". Now you can drag and drop files from the explorer window (right) to the Data-CD layout (left). After you added all files and folders to the layout that you need, click on "Burn Disk" at the left side. Instead of "Burn" choose "Save ISO" now. The last thing you have to do now, is to choose the location and name of your image-file." Combine with Daemon tools as you have. When removing Daemon, you sometimes have to use a few tricks to get all the drivers cleanly removed, but that is not difficult (i.e. ask again). --Seejyb 06:43, 3 July 2006 (UTC)[reply]
Interesting, but I was actually thinking of something to extract iso images from CDs, CDburnerXP can turn normal files into ISOs too.--Frenchman113 on wheels! 12:53, 3 July 2006 (UTC)[reply]

A question about Bubble Sort

[edit]

Hello, I just read the theory of bubble sort, and tried to implement it. But not too sure if the results are right. I mean, the number of steps taken to reach the final results is right or wrong, thats what i am confused about. So if anyone could run this code, see the results and comment whether its right or not. Its written in C.

At the end of the execution, it displays the the steps used in sorting in an ordered way, and indicates those values which have been sorted from previous step in yellow color.

 #include<stdio.h>
 #include<conio.h>
 void main()
 {
 int orig[25],orig2[25];
 int i,j,n,temp,m,step=0;
 int compary[25],var,change=0,change_count=0;
 clrscr();
 printf("how many elements : ");
 scanf("%d",&n);

 for(i=0;i<n;i++)
 {
 printf("enter number %d : ",i+1);
 scanf("%d",&orig[i]);
 orig2[i]=orig[i];
 compary[i]=orig[i];
 }
 clrscr();
 textcolor(WHITE);
 cprintf("step  0 : ");
 for(m=0;m<n;m++)
 cprintf("%3d  ",orig[m]);
 cprintf("    (original)");
 printf("\n---------------------------------\n");
 for(i=0;i<n;i++)
 {
	for(j=0;j<n-1;j++)
	{

		step++;
		printf("step %2d : ",step);


		if( orig[j] > orig[j+1] )
		{
		 temp=orig[j];
		 orig[j]=orig[j+1];
		 orig[j+1]=temp;
		}


		

		for(m=0;m<n;m++)
		{
			if( orig[m]!=compary[m] )
			{
			textcolor(YELLOW);
			cprintf("%3d  ",orig[m]);
			
			
			}
			else
			{
			textcolor(WHITE);
			cprintf("%3d  ",orig[m]);
			
			}

		}

 printf("\n");
 for(var=0;var<n;var++)
 compary[var]=orig[var];
	}





 }





 getch();
 }
This didn't even compile for me until I removed all the "conio.h" stuff. What is that anyway, some Windows thing? Also, main() should return int, not void. Your algorithm seems correct but inefficient: there's no need to go all the way to the end of the list every time, because after the first pass the last element is definitely the greatest. The number of swaps should keep getting shorter and shorter by one until there are no more swaps to be made. See what I mean? —Keenan Pepper 15:51, 2 July 2006 (UTC)[reply]
conio.h is a MS-DOS thing (its equivalent in the POSIX world would be curses). --cesarb 03:40, 3 July 2006 (UTC)[reply]

well,i reformatted the code. the code is definitely right, nothing wrong in it. And also, the number of times it runs is high bcoz to display the numbers in different colors. But is the end result correct in terms of steps required?

How do you know it's "definitely right"? void main is wrong. The number of steps is not correct, there are about twice as many as there need to be, as I explained. —Keenan Pepper 16:33, 2 July 2006 (UTC)[reply]

Each iteration of the "j" loop is going too far. It should say for(j=0;j<n-1-i;j++). You're doing exactly twice as many iterations of the inner loop as you need to. -jpgordon∇∆∇∆ 16:37, 2 July 2006 (UTC)[reply]

Depending upon what it is you have to sort and how fast you need it sorted you might want to look at a recently published sort that is up for peer review on the Wikia Acadenic Publishing site (a commercial wiki site owned by Jimbo). Its at Check sort description. Both C++ and Visual Basic code are listed. ...IMHO (Talk) 17:24, 2 July 2006 (UTC)[reply]

Ok, I read all of your comments and advice. So then I googled for C programs on bubble sort. I found around 3 on the first page itself. I ran all of those programs. I tested all of those on the following sequence of numbers : 44,33,55,22,11. And for all of those, the number of swaps required was 8. In my above code also, number of steps required is 8. Then I re-wrote the above code, wihout colors and all that. But still I wrote it such a way that, after every increment in variable j, the result is shown. And the number of steps through which the outer loop runs is 20, for my programs, and must be same for those googled programs also bcoz they also have same logic. So the end result is the same in any case : 8 swaps. I just happened to display every single step in the result table, which actually is taking place. So I think the above code is correct. But still, I put my new code below, which follows same principle, but doesnt display swapped numbers in colors. I hope I have got it right this time!

#include<stdio.h>
#include<conio.h>

void main()
{
int orig[20];
int i,j,temp,swap=0,n,m,step=0;

clrscr();

printf("Number of data : ");
scanf("%d",&n);

for(i=0;i<n;i++)
{
printf("enter number %d : ",i+1);
scanf("%d",&orig[i] );
}

clrscr();

printf("step 0  :  ");

for(i=0;i<n;i++)
printf("%3d  ",orig[i]);
printf("   (original array)\n");

for(i=0;i<n;i++)
{

	for(j=0;j<n-1;j++)
	{

	 step++;
	 	if(orig[j]>orig[j+1])
		 {
		  temp=orig[j];
		  orig[j]=orig[j+1];
		  orig[j+1]=temp;
		  swap++;
		 }//end of if()

	 printf("step %3d: ",step);
	 for(m=0;m<n;m++)
	 printf("%3d  ",orig[m]);
	 printf("\n");

	}//end of j loop

}//end of outermost i loop


printf("\n\n-------------------------\n");
printf("NUMBER OF SWAPS : %d",swap);

getch();
}//end of main

If there are any further corrections or advice, please tell, I am eager to learn more. Thank You.

  • You're still doing twice as many iterations of the inner "j" loop than you need to. The first time through the "i" loop, element [n-1] -- the last element in the array -- is guaranteed to the largest. So you never need to look at it again; the inner loop can be one shorter. After the second iteration, the second to last element is guaranteed to be second largest. And so on. So, as I said before, the inner loop needs to be
 for(j=0;j<n-1-i;j++)
Certainly you will get the correct results -- but that's easy; the trick in sorting is to get the correct results efficiently. The bubble sort is inherently inefficient, but you're making it worse. --jpgordon∇∆∇∆ 21:52, 2 July 2006 (UTC)[reply]
If you need speed and efficiency use the Check or the Rapid sort. ...IMHO (Talk) 01:18, 3 July 2006 (UTC)[reply]
If you need speed and efficiency, use the sorting function in your language's built-in library. There's no need to reinvent the wheel. —Keenan Pepper 01:40, 3 July 2006 (UTC)[reply]
Yeah, but you don't learn anything that way. Bubble sort is a good start because (a) it's easy to implement, and (b) it's way inefficient, hence good to learn from. --jpgordon∇∆∇∆ 02:47, 3 July 2006 (UTC)[reply]
If you need speed and efficiency, try introsort (the sorting function in your language's built-in library is probably either quicksort or introsort). --cesarb 03:40, 3 July 2006 (UTC)[reply]

Well thank you everyone for your useful tips and suggestions. Just one last question about bubble sort. I think that even if all the entered numbers (say n) for sorting are already sorted, even then bubble sort would traverse through the array (n-1 times). So if I entered 1,2,3,4,5 then also the sort would traverse 5-1=4 times through the array. Am I right?

And yes, I changed the for loops of the algorithm as

for(i=0;i<n-1;i++)
    
     for(j=0;j<n-1-i;j++)

So now I think I have a better algorithm than previous two versions. And yes, some of you had mentioned me to use qsort or other inbuilt functions, but actually I wanted to try these algorithms out because I had never done so previously. Though I have been programmin in C as a student, but still these things were quite new to me, so I thought why not try these out myself. Thank you all of you anyway once again. Bye.

metaboloites

[edit]

My question is simple : do lidocaine metabolites in any way similar to cocaine metabolites, and couls an urine test for cocaine result positive after massive intake of injected lidocaine at the dentist? Sincerely —Preceding unsigned comment added by 85.139.118.130 (talkcontribs) 16:25, 2 July 2006

They are both in the chemical class of alkaloids, as are many other commonly and uncommonly used druges, but legally reliable drug tests for cocaine are specific for cocaine and do not react to lidocaine. alteripse 16:59, 2 July 2006 (UTC)[reply]

Erowid.org has the following to say about cocaine and the various other -caines. "In spite of the similarity in names, these drugs are not very closely related chemically to cocaine. They aren't even all chemically related to each other."

Don't forget, however, not to eat a significant amount of poppy seeds before a drug test. --Ginkgo100 talk · contribs 21:22, 2 July 2006 (UTC)[reply]

Nice Looking Carnivorous Plants

[edit]

Can anyone recommend some carnivorous plants that are effective at removing flies (i.e. not a bulbous venus fly trap) and the look like you'd actually want them in your garden (i.e. not a bulbous venus fly trap). I've been to the carnivour plants article, but there aren't many pictures... isn't there a plant with a long white flower thing in which the fly enters and dies? --Username132 (talk) 16:48, 2 July 2006 (UTC)[reply]

Link to the Google image search page and enter carnivorous or the name of the plant you want to see. ...IMHO (Talk) 18:03, 2 July 2006 (UTC)[reply]
What you can grow will largely depend on your climate, but Pyrethrum is a natural insecticide. I somehow doubt any number of plants will significantly reduce the number of flies around, as they "eat" very few of them.--Shantavira 19:57, 2 July 2006 (UTC)[reply]
My completely non-expert view: exterminating flying insects and cool plants that occasionally eat the odd fly are completely different things. A fly eating plant is a very slow thing; if you have a real fly infestation you'll need an unreasonably large number of venus fly traps to make even the tiniest dent in the problem. Weregerbil 21:05, 2 July 2006 (UTC)[reply]

Your average carnivorous plant will only grow in a wetland, so you may need to put it in a special pot, rather than plant it in the soil (unless your soil has a low level of nitrogen. Emmett5 03:03, 3 July 2006 (UTC)[reply]

Budgerigar behaviour question

[edit]

When my budgie goes to sleep at night, instead of sleeping on one of her perches, she climbs up the bars to the very top right corner of the cage, wedges herself in there, tucks her head into her back and dozes off. Anyone know why she might be doing this? She is otherwise a healthy little bird. --Kurt Shaped Box 19:24, 2 July 2006 (UTC)[reply]

Because she finds it comfortable, I'd imagine. However, consider than budgies nest in holes and often like enclosed spaces; maybe that is why she feels more comfortable that way. The head-tucking is very common for sleeping birds. --Ginkgo100 talk · contribs 21:24, 2 July 2006 (UTC)[reply]
I sometimes do that (except that I don't have any bars in my bed). :) DirkvdM 11:12, 3 July 2006 (UTC)[reply]
Don't knock it till you've tried it.  :) User:Zoe|(talk) 01:53, 4 July 2006 (UTC)[reply]

Coloration

[edit]

So, I've got a pair of Sony Professional MDR-7506s on, and I read on the internet "there is not the smallest bit of coloration." After reading coloration, I have the question to ask: "If I have some ageing speakers, will they produce more coloration? I've got two Bose speakers that are 15 years old, will they produce more coloration than they did than when I bought them? -- User:Mac_Davis

I've wondered this as well. I have 16-year-old Ohm speakers that I'd like to sell. I went online and found out that I need to buy new cones for them because the old ones would have too much coloration by now. From memory, the Ohm site said that the cardboard cone becomes brittle over time. Eventually, it will crack. I considered buying new speakers for them, but that is too much work, so I still have the huge things taking up room in my closet until I make a trip to Goodwill. --Kainaw (talk) 22:04, 2 July 2006 (UTC)[reply]