need a code sample for bubble sort

J

Jon Skeet [C# MVP]

Mark Kamoski said:
I need a code sample for <xyz> sort.

Well, there are samples for any number of sorts online in various
different languages - it should be easy enough to convert them to C#.
Could I ask why you need samples for so many different sorts?
 
C

Cowboy \(Gregory A. Beamer\)

That is highly likely. Since the examples I found were simple google
searches, I should have pointed to google.com instead. ;->

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
M

Mark Kamoski

Jon--

I've got to benchmark performance for these for an "analysis of algorithms"
course.

So, it is for an assignment but we have the OK to get the code samples
anywhere we want.

We wrote these in last semester's course in C++ but (yes) I don't feel like
rewriting them.

So, am I "lazy" or am I just "trying to avoid re-inventing the wheel"?

You decide.

--Mark


Mark Kamoski said:
I need a code sample for <xyz> sort.

Well, there are samples for any number of sorts online in various
different languages - it should be easy enough to convert them to C#.
Could I ask why you need samples for so many different sorts?
 
M

Mark Kamoski

Brian--

Actually, the assignment primarily involves a write-up and a graphing of
the result of a comparison of the algorithms.

It is funny because one already knows that some of these have (n^2) running
time and some have (nlogn) but we need to run the tests.

As I stated to Jon, above, the prerequisite course involved writing these
algorithms in C++.

Am I "lazy" or am I rightly choosing to "avoid reinventing the wheel"?

You decide. I already know the answer to that one.

Thank you.

--Mark


Could I ask why you need samples for so many different sorts?

He wants someone to do his homework assignment for him? ;-)
 
M

Mark Kamoski

Greg--

Thank you very much.

I appreciate it.

I have more work than time (as usual) and so this helps out a lot.

Thanks again.

--Mark





message http://billimek.com/code/strategysort/bubble sort strategy.html
http://www.brpreiss.com/books/opus6/html/page492.html
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=526

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
E

Eric Cadwell

So, am I "lazy" or am I just "trying to avoid re-inventing the wheel"?
You decide.


Your ****ing lazy!!!
Or your too dumb to do a google search.

You decide!

-Eric
 
E

Eric Cadwell

So, am I "lazy" or am I just "trying to avoid re-inventing the wheel"?
You decide.


Your ****ing lazy!!!
Or your too dumb to do a google search.

You decide!

-Eric
 
E

Eric Cadwell

So, am I "lazy" or am I just "trying to avoid re-inventing the wheel"?
You decide.

Your f'ing lazy!!!
Or your too dumb to do a google search.

You decide! The rest of us know the answer to that one.

-Eric
 
E

Eric Cadwell

So, am I "lazy" or am I just "trying to avoid re-inventing the wheel"?
You decide.


Your f'ing lazy!!!
Or your too dumb to do a google search.

You decide!

-Eric
 
M

Mark Kamoski

Eric--

Your comments are out of sync with the spirit of a newsgroups intent--
namely, to share information with others and to help others.

If you don't want to help someone who asks for help, then that is fine.

Regardless, you have NOT addressed the other possibility mentioned-- that
is, the need for humankind to avoid re-inventing the wheel.

Aside from this, you have missed many other points.

What if WebSense here does not let me do Google searches but does allow
Outlook Express newsgroup access?

And so on.

Afterall, if you are trying to argue that asking for a code sample of a
particular algorithm written in C# is off-topic in a newsgroup called
"microsoft.public.dotnet.languages.csharp", then there is no point in
continuing this conversation.

More to the point, I have seen your type of attitude a lot. Someone asks a
simple question and they are met with mean-spirited responses. It is
typical of someone who is angry and petty.

Let's look at something else. Before my posts, when one tried a Find in
Outlook Express in this newsgroup,
"microsoft.public.dotnet.languages.csharp", for something common like
"bubble sort", one got no results. Until now, after my posts. Perhaps you
don't think it valuable to index and link such information into this
newsgroup. So be it. I, however, do believe it is valuable and that's one
of the reasons I have posted here.

One has to ask-- is it my goal to help people or to simply say "go ask
someone else"?

I wonder, Eric, how would you answer this question?

In short, if one were to extend your thinking as suggested in your message
below, this entire newsgroup could be replaced with a single post that
simply says "please search Google for your answers", which is, of course,
quite silly.

This is common today. How many times do people say in verbal
conversations...

"you should check the web on that"

....well, of course. But is this really more than a dodge to answer a
question directly? Note that the web is NOT the only source of information.
Futhermore, what is the web if not a small segment of human knowledge. Who
better to ask about the contents of the human mind than another human.
Perhaps this seems odd to you, but to me it does not.

Which begs the question, why does this newsgroup exist?

It is academic to see that it exists as a place for people to ask questions
about the language CSharp, which is precisely what I have done.

If you haven't time to come down off your high horse to help someone with a
question, then I daresay you are spending your time in the wrong place.

What is more, if you time is so precious as to be hindered by the
interruptions of simple question, then it is all the more curious as to why
you would sacrifice a slice of that precious time to flame a legitimate
post. Only you can answer this.


Oh well, Eric. Perhaps we see things differently.

Let's see what YOU do from here onward.

My prediction is that you will either...

lash our with some sort of petty, better-than-you, newsgroup bully flame

....or...

you will respond rationally and calmly, as civilization and the advancement
of knowledge dictates.

But, that's just a prediction. Let's see.

The future is yours to write, Eric. Use a pencil in case you make a
mistake.







Eric Cadwell said:
So, am I "lazy" or am I just "trying to avoid re-inventing the wheel"?
You decide.

Your f'ing lazy!!!
Or your too dumb to do a google search.

You decide! The rest of us know the answer to that one.

-Eric
 
K

Kieran Benton

Sorry Mark but your still lazy, I had to do something very similar myself at
university and the whole point is to learn by writing them yourself from
just the algorithm. If I did what you are doing I would have been done for
plagiarism! ;)

Kieran
 
M

Mark Kamoski

Kieran--

I appreciate your response, but your assumptions about MY assignment are
simply not correct.

Our assignment is to analyze, NOT to write the algorithms.

The instructor specifically said "don't bother writing the algorithms...
get the algorithms from a book or the internet... this is a course in
analysis, not in programming".

It sounds like the intent of the course you took is different from the one
that I am now taking.

Oh well.

By the way, I'll take the time to caution everyone to avoid arguing against
"code reuse" in general as it is a circular path to "write everything from
scratch".

Case and Point: Ask yourself-- Did I WRITE the .NET Framework? Do I USE
..NET Framework?

And so on.

Then again, perhaps we see things differently.

Take care.

--Mark






"Kieran Benton" <kieranbenton athere hotmail.com> wrote in message
Sorry Mark but your still lazy, I had to do something very similar myself
at
university and the whole point is to learn by writing them yourself from
just the algorithm. If I did what you are doing I would have been done for
plagiarism! ;)

Kieran
 
D

Daniel O'Connell

If I may, I'd like to offer a little advice.
First, don't make a half dozen posts asking for basically the same thing. A
single post that went something like:

Does anyone have any links to samples of sort algorithms, like bubble,
merge, quicksort, etc in C#.

and if you don't run across everything you want, ask again for a specific.
This is less cluttery and results in less work for the people here who are
trying to read the couple of hundred messages that built up overnight.
Questions posed like I posted above don't always bring people to the
assumption that you are doing homework so much as you are trying to learn,
and people are here to help you learn (and to get help learning themselves),
doing someones homework is not conducive to learning.
Also, try checking google before posting here, both the general web and the
newsgroup archives, most of the time its quicker and you get less flack.
 
E

Eric Cadwell

Just giving my opinion. Sorry if I judged you in haste, but I doubt that's
the case. You're wasting the time of some very important people who have
better things to do than your homework.

You didn't ask an academic question about C#, you specifically asked for
some measure of work to be done for you, simply because you're too lazy to
do it (or find it) yourself. The responsible people who come here with
questions have exhausted at least some amount of their own resources to find
(or figure out) the problem for themselves.

Most of the responses in this list are in fact just a redirection to a
website, and most of the posts here have been answered a dozen times or
more. Your not trying to avoid reinventing the wheel, your asking someone
else to do it for you! Why should the people in this newsgroup rewrite the
Bubble Sort for you?

The answer to 99% of the questions posted here can be found in Google (via
the web or newsgroup posts themselves). I don't want to hear "maybe I can't
get to the Internet", because even my public library has free Internet
access (not too mention a few shelves packed full of programming books).

Imagine a world where people learned to figure out things for themselves by
leveraging the public knowledge that already exists (your only valid point -
that this posting will serve as a beacon for the next lazy person who
enrolls in the same class you did):

bubble sort group:*csharp - I get 20 hits
http://groups.google.com/groups?as_...ie=UTF-8&oe=UTF-8&as_ugroup=*csharp&lr=&hl=en

bubble sort C# - I get 1650 hits
http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=bubble+sort+c#

This is a community site. I try to contribute to the list as much as
possible, even if it's just to help answer the brain-dead questions (from
people like you) that have been asked a million times. In return, I post
questions regarding problems that I encounter, without feeling
self-absorbed. What do you offer in return for the help given to you?
Nothing!

You got a few things right:

1. I'm angry. I have posted a few questions to real world problems in the
last couple of weeks, the answers to which are not readily available
anywhere else (I know because I took the time to look for myself). It seems
that people are too busy answering your lame questions to help me!

2. C# is the place to be.

-Eric
 
D

Daniel O'Connell

While I agree that this post was a little on the lazy side and not the best
stated, as far as I'm concerned its a valid topic to post on. If you don't
want to answer it you are more than welcome to simply not answer it.
At the same time, the number of posts that people make(who will probably
never check the archives) makes me think a FAQ page needs to exist so that
the answer can just be posted with a single, concise URL. As it stands
sometimes I skip messages simply because I don't have the energy to restate
everything thats been said before.
 
E

Eric Cadwell

I chose to answer the one question posted by Mark that I felt he needed the
most help with:

Whether or not he was lazy.

An FAQ won't solve the problem. The problem is that people are too lazy to
do their own research. You can make the most comprehensive FAQ and people
still won't take the time to read it (let alone have to search for it).

If a good FAQ was the answer (I'll point out Bob Powell's GDI+ FAQ and
George Shepherd's WinForms FAQ), you'd only be getting one or two posts a
day in most of these groups.

-Eric
 
D

Daniel O'Connell

Eric Cadwell said:
I chose to answer the one question posted by Mark that I felt he needed the
most help with:

Whether or not he was lazy.
Yes he was lazy, as to if it was the one he needed the most help with is
debatable. Most of the time it is best for those of us posting replies and
helping out simply to hold our tongues and let things be. Reputations do
build and there is always the chance you will offend someone who has the
answer to a question you yourself post.

I know the annoyance of not having questions answered(the vast majority of
questions i've post have gone unanswered)
An FAQ won't solve the problem. The problem is that people are too lazy to
do their own research. You can make the most comprehensive FAQ and people
still won't take the time to read it (let alone have to search for it).

If a good FAQ was the answer (I'll point out Bob Powell's GDI+ FAQ and
George Shepherd's WinForms FAQ), you'd only be getting one or two posts a
day in most of these groups.
The existance of a FAQ alone is not the point. People aren't going to find
it. My point was that having answers to things like static abstracts,
checked exceptions, and other questions I see fielded every week,
referencing the group posts would simply save time for those of us trying to
make replies. If I post something they don't care to read, thats fine, I've
done what I intended to do. I don't even mind fielding some simple questions
that are asked alot, but I get tired of the same weekly questions on the
design of the language, etc, that no single page covers in detail. It is
alot of work to find a good, comprehensive set of answers that everyone will
agree with, most faq's don't provide the kind of answers those questions
need, but the pre-existing posts that have been made do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top