[Show all top banners]

zeePa
Replies to this thread:

More by zeePa
What people are reading
Subscribers
Subscribers
[Total Subscribers 1]

paroo
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Help me techguy/(& techgirl if he has one!)
[VIEWED 5978 TIMES]
SAVE! for ease of future access.
Posted on 10-29-08 7:14 PM     Reply [Subscribe]
Login in to Rate this Post:     2       ?     Liked by
 

Write a program that implements a method that receives an array parameter and sorts that array using the bubble-sort algorithm. The bubble-sort algorithm makes several passes through the array. On each pass, successive neighboring pairs are compared. If a pair is in decreasing order, its values are swapped: otherwise, the values remain unchanged. The technique is called a bubble sort because the smaller values gradually "bubble" their way to the top.

USE THIS ALGORITHM:

boolean changed;

do{

  changed = false;

  for(int i = 0; i < list.length - 1; i++){

    if(list[i] > list[i + 1]){ 

      swap list[i] with list[i + 1];
      changed = true; 
    }

  }
}while(changed


 
Posted on 10-29-08 7:39 PM     Reply [Subscribe]
Login in to Rate this Post:     2       ?     Liked by
 

ha ha ha.. this is freaking crap.... no one's going to write a whole code for you... you should practice it yourself and post the lines of codes where you get error... If you keep on posting your problems in the blogs and someone posts the codes then when you'll learn to code yourself? Do, some research dude, read some books, follow programming basics and finally you'll be able to generate the codes by yourself...

 
Posted on 10-29-08 8:06 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Seriously? You can't even code a simple bubble sort algorithm?

I am sorry to be so critical of you zeepa but I think programming is not for you.

 
Posted on 10-29-08 8:30 PM     Reply [Subscribe]
Login in to Rate this Post:     2       ?     Liked by
 

is that your assignment given by your professor...if so..its better to get help from your professor ....we are here to learn...not to plagiarize...
 
Posted on 10-29-08 9:05 PM     Reply [Subscribe]
Login in to Rate this Post:     1       ?     Liked by
 

You have already done everything, where r u stuck...about that swap logic?

well here is how it works,

suppose you have oil on bucket A

A=oil

 and water in bucket B

B=water

, now you got to transfer oil to B and water to A,

final result B=oil, A=water

 how will you do it?

Take another empty bucket C.

Put oil from A to C

C=A; (well in  real world bucket A will get empty, but in programming,  A and C both will have oil, ignore  that and think this is real world)

Then,

Put the content of B(water) to A, so A contains water

A=B;

then put the content of C(oil)  to B, so B contains Oil

B=C

This is how swap works.

For your problem

temp=list(i);

list(i)=list(i+1);

list(i+1)=temp;

Hope that explains .

 Post your code, if therez logical or syntax error we can point it out. Java or C or C++?


 
Posted on 10-29-08 9:33 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Thanks techguy! BTW, its java.

This was specifically for you. Others talked about plagiarism and shit like that. I tell u , except techguy, what!

Fear of Plagiarism shouldn't hinder sharing of knowledge. Knowledge is open surce and free!

Techguy knows what i am talking about!

But guys, I am cool with your suggestions too..

thanks anyways.


 
Posted on 10-29-08 10:42 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Plagiarism not only hinders sharing of knowledge but is the lowest you can go. I mean it is good to have a genuine desire to learn but blatant plagiarism and copying isn't the right way.

However I do like Techguy's style of analysis and I hope that it helped you. Good luck.

 
Posted on 10-30-08 12:23 AM     Reply [Subscribe]
Login in to Rate this Post:     1       ?     Liked by
 

Asking questions is not plagiarism.Copying from someone else is.

 
Posted on 10-30-08 9:47 AM     Reply [Subscribe]
Login in to Rate this Post:     1       ?     Liked by
 

Over the last few threads, I am kind of amazed with people bashing someone asking for help. And People who are asking for help are asking for the whole code... #include ... to return blah.

I think you are doing java, and it is a good question, how to pass array to a function. As java does not use pointers like C++.

Zeepa, you seem to have already done the hard part, so whats going  on ? make a function, like the question says passs an argument ( array). .

String myArray == new array[20];
// put your values into myArray in each elements.

public string  myArrayFunction( myArray) {

 type that code... you found or did.

return myArray; // which at this point is already sorted.
}

Last edited: 30-Oct-08 09:52 AM

 
Posted on 10-30-08 4:19 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I saw kudos to Techie bro and yellow.. the poster is trying to learn, what the hell yaar.. if you don't' want to help than don't' ridicule the poor chap..

Maybe he doesn't' want to be a programmer, he has to take programming class to get his degree... what is wrong with cheating and passing if you are not going to use it ever in your life...>???

so most of you guy's here are trying to tell us, you guys are geniuses..
a learned man will never make fun of a person who has less knowledge than them,., that only shows how intelligent you are..

 
Posted on 10-31-08 9:12 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Test it. I may be wrong. I did not test it.

/// Routine sorts the array that holds integer values. Make sure list[i] returns integer but NOT string or object or double or any

//boolean changed; not needed
//changed = false; not needed
int temp = 0;

  for(int i = 0; i < list.length - 1; i++){

    //initialize the temp varaible for every spin
    temp = 0;

    //Swap it only if first value is greater than next value
    if(list[i] > list[i + 1]){ 
    temp = list[i];

    list[i] = list[i+1];

    list[i+1] = temp;

    //swap list[i] with list[i + 1]; 
    // changed = true; not needed
    }

  }


 
Posted on 10-31-08 12:03 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

this dude is too lazy lol
 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 365 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
TPS Re-registration
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
ChatSansar.com Naya Nepal Chat
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
Toilet paper or water?
TPS EAD auto extended to June 2025 or just TPS?
Do nepalese really need TPS?
Biden out, Trump next president, so what’s gonna happen to TPS, termination?
Nas and The Bokas: Coming to a Night Club near you
मन भित्र को पत्रै पत्र!
Will MAGA really start shooting people?
Democrats are so sure Trump will win
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
From Trump “I will revoke TPS, and deport them back to their country.”
Tourist Visa - Seeking Suggestions and Guidance
Top 10 Anti-vaxxers Who Got Owned by COVID
Nas and The Bokas: Coming to a Night Club near you
Mr. Dipak Gyawali-ji Talk is Cheap. US sends $ 200 million to Nepal every year.
TPS Update : Jajarkot earthquake
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters