Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C Programming Language

largest no


how can i pick up largest no from 5 rows by 5 column matrix????
how can i pick up largest no from 5 rows by 5 column matrix????
<bele_harshad2@yahoo.co.in> schrieb im Newsbeitrag
news:1181123442.757983.117760@x35g2000prf.googlegroups.com...
> how can i pick up largest no from 5 rows by 5 column matrix????

By copmaring the first with the send, then the larted of that comparisn with
the 3rd, the larger of that with the 4th and so on until the 25th

Bye, Jojo

<bele_harshad2@yahoo.co.in> schrieb im Newsbeitrag
news:1181123486.285232.125040@q19g2000prn.googlegroups.com...
> how can i pick up largest no from 5 rows by 5 column matrix????

Yes, we got it the 1st time already...
On 6 Jun, 10:50, bele_harshad2@yahoo.co.in wrote:

> how can i pick up largest no from 5 rows by 5 column matrix????

Step 1. Sort the columns of each row into ascending order.
Step 2. Sort the rows into ascending order using the last column as
the key.
Step 3. Pick the last column of the last row.
 mark_blue@pobox.com said:

> On 6 Jun, 10:50, bele_harshad2@yahoo.co.in wrote:
>> how can i pick up largest no from 5 rows by 5 column matrix????

> Step 1. Sort the columns of each row into ascending order.
> Step 2. Sort the rows into ascending order using the last column as
> the key.
> Step 3. Pick the last column of the last row.

I'm sure we can do better than O(c log c + r log r). Perhaps we should
specify a particular sort. That can get us right up to O(c^2 + r^2)
without any major effort. But can anyone find an exponential-time
algorithm?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.

On 6 Jun, 11:29, Richard Heathfield <r@see.sig.invalid> wrote:

>  mark_blue@pobox.com said:

> > On 6 Jun, 10:50, bele_harshad2@yahoo.co.in wrote:
> >> how can i pick up largest no from 5 rows by 5 column matrix????

> > Step 1. Sort the columns of each row into ascending order.
> > Step 2. Sort the rows into ascending order using the last column as
> > the key.
> > Step 3. Pick the last column of the last row.

> I'm sure we can do better than O(c log c + r log r). Perhaps we should
> specify a particular sort. That can get us right up to O(c^2 + r^2)
> without any major effort. But can anyone find an exponential-time
> algorithm?

There's a big problem here, though - how can we sort anything when we
don't know how to tell whether one thing is larger than another?
<mark_blue@pobox.com> schrieb im Newsbeitrag
news:1181128492.399756.63130@o5g2000hsb.googlegroups.com...

Hmm, the OP talked abut 'no' wich I assume to mean 'number', so it probably
is some integral or floating point number, which are fairly easy to find the
larger.

Bye, Jojo

On 6 Jun, 12:25, "Joachim Schmitz" <nospam.j@schmitz-digital.de>
wrote:

Finding the largest value in some set is a trivial extension of
finding which of two values is the larger - if the OP wanted us to
write code to do the former, it implies they probably can't do the
latter...
<mark_blue@pobox.com> schrieb im Newsbeitrag
news:1181129890.964660.56020@p47g2000hsd.googlegroups.com...

To me it sounds like a homework assignment...

Joachim Schmitz wrote:
> <mark_blue@pobox.com> schrieb im Newsbeitrag

... snip ...

>> Finding the largest value in some set is a trivial extension of
>> finding which of two values is the larger - if the OP wanted us
>> to write code to do the former, it implies they probably can't
>> do the latter...

> To me it sounds like a homework assignment...

No!  I can't imagine a student trying to pull such a scurvy trick.
Couldn't possibly be true!

--
 <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
 <http://www.securityfocus.com/columnists/423>
 <http://www.aaxnet.com/editor/edit043.html>
 <http://kadaitcha.cx/vista/dogsbreakfast/index.html>
                        cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

You apparantly totally missed the humor involved in RH's post.

--
 <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
 <http://www.securityfocus.com/columnists/423>
 <http://www.aaxnet.com/editor/edit043.html>
 <http://kadaitcha.cx/vista/dogsbreakfast/index.html>
                        cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

"CBFalconer" <cbfalco@yahoo.com> schrieb im Newsbeitrag
news:4666D14E.D9A3A057@yahoo.com...

Me too I must admit. Isn't that what smileys have been invented for?

Bye, Jojo

Richard Heathfield <r@see.sig.invalid> writes:
>  mark_blue@pobox.com said:
>> On 6 Jun, 10:50, bele_harshad2@yahoo.co.in wrote:
>>> how can i pick up largest no from 5 rows by 5 column matrix????

>> Step 1. Sort the columns of each row into ascending order.
>> Step 2. Sort the rows into ascending order using the last column as
>> the key.
>> Step 3. Pick the last column of the last row.

> I'm sure we can do better than O(c log c + r log r). Perhaps we should
> specify a particular sort. That can get us right up to O(c^2 + r^2)
> without any major effort. But can anyone find an exponential-time
> algorithm?

Google "permutation sort".

--
Keith Thompson (The_Other_Keith) k@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

On 06/06/2007 18:29, Joachim Schmitz wrote:

A smiley would ruin the joke considerably, I must say.

--
Denis Kasak

Richard Heathfield wrote:
>  mark_blue@pobox.com said:

>> On 6 Jun, 10:50, bele_harshad2@yahoo.co.in wrote:
>>> how can i pick up largest no from 5 rows by 5 column matrix????
> I'm sure we can do better than O(c log c + r log r). Perhaps we should
> specify a particular sort. That can get us right up to O(c^2 + r^2)
> without any major effort. But can anyone find an exponential-time
> algorithm?

Arrgh.. exponential-time??! The worst sorting algorithms I know, are
O(N^2). :-/

I can't remember Knuth or Sedgewick, discussing anything worse than that.

Give a hint please..

--
Tor <torust [at] online [dot] no>

Tor Rustad said:

Well, let's see now...

while not sorted
  exchange two elements at random
endwhile

That would do it, I think.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.

Sorry, permutation sort isn't exponential-time.  (It's worse.)

--
Keith Thompson (The_Other_Keith) k@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

bele_harshad2@yahoo.co.in wrote:
> how can i pick up largest no from 5 rows by 5 column matrix????

No matrices in C, sorry. We do have arrays though. Consider..

int arr[5][5];

Does this satisfy your description of a matrix?

The arr array has 25 elements. We can find the largest of them by simply
tripping through the array comparing 'this' one to the previously larger
one. The position of the largest element in the array might also be of
interest. Consider..

int i, j, r, c, max = 0;

for (i = 0; i < 5; ++i)
    for (j = 0; j < 5; ++j)
       if (arr[i][j] > max) {
          max = arr[i][j];
          r = i, c = j;
       }

When this finishes, max will hold the largest int and r and c will tell
you where it is. And very quickly.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
                     --- Albert Einstein ---

If the exchanges are truly random, that's not guaranteed to terminate,
so it doesn't qualify as an algorithm.

--
Keith Thompson (The_Other_Keith) k@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

I don't know the O(), but try simply rearranging the sortee at
random, then check if sorted.  If not, repeat.

--
 <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
 <http://www.securityfocus.com/columnists/423>
 <http://www.aaxnet.com/editor/edit043.html>
 <http://kadaitcha.cx/vista/dogsbreakfast/index.html>
                        cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Yes it is, given sufficient time and a really random generator :-)

--
 <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
 <http://www.securityfocus.com/columnists/423>
 <http://www.aaxnet.com/editor/edit043.html>
 <http://kadaitcha.cx/vista/dogsbreakfast/index.html>
                        cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

No, it's not.  A truly random generator can generate any possible
sequence, including a sequence that causes the code to repeatedly swap
the first two elements forever.  The worst-case behavior is that it
never terminates.

It isn't certain to terminate, but it terminates in some finite time
with probability 1.  I *think* that's right.  In any case, this
stopped being about C some time ago.

--
Keith Thompson (The_Other_Keith) k@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

On 2007-06-06 20:18:36 -0700, CBFalconer <cbfalco@yahoo.com> said:

No, given a truly random number generator, the probability that it will
terminate *approaches* 100% as time approaches infinity. However you
never have an absolute guarantee that it will terminate as there is a
non-zero chance that , for instance, the sequence of numbers is nothing
but the number 42 repeated an infinite number of times.

--
Clark S. Cox III
clarkc@gmail.com

On 6 Jun, 17:29, "Joachim Schmitz" <nospam.j@schmitz-digital.de>
wrote:

I didn't.

> Me too I must admit. Isn't that what smileys have been invented for?

As Denis points out, that would ruin the joke. "Dry" humour and irony
(both rather British) should never be sullied with emoticons.
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc