Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #77065 > unrolled thread

qsort() function misunderstanding

Started byAlla _ <modelling.data@gmail.com>
First post2015-11-24 01:48 -0800
Last post2015-11-25 09:07 -0800
Articles 20 on this page of 49 — 14 participants

Back to article view | Back to comp.lang.c


Contents

  qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-24 01:48 -0800
    Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-24 10:32 +0000
      Re: qsort() function misunderstanding Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-24 11:08 +0000
        Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-24 12:03 +0000
          Re: qsort() function misunderstanding Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-24 16:12 +0000
      Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-24 03:33 -0800
        Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-24 12:05 +0000
          Re: qsort() function misunderstanding glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-24 13:52 +0000
            Re: qsort() function misunderstanding Ken Brody <kenbrody@spamcop.net> - 2015-11-24 10:01 -0500
          Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-24 06:04 -0800
            Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-24 14:16 +0000
        Re: qsort() function misunderstanding James Kuyper <jameskuyper@verizon.net> - 2015-11-24 07:32 -0500
          Re: qsort() function misunderstanding Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-24 16:43 +0000
            Re: qsort() function misunderstanding glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-25 05:58 +0000
              Re: qsort() function misunderstanding Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-25 11:34 +0000
                Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-25 12:45 +0000
                  Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-26 02:18 -0800
                    Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-26 10:45 +0000
                Re: qsort() function misunderstanding glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-25 14:46 +0000
            Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-25 00:51 -0800
              Re: qsort() function misunderstanding James Kuyper <jameskuyper@verizon.net> - 2015-11-25 08:12 -0500
                Re: qsort() function misunderstanding Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-25 14:02 +0000
                  Re: qsort() function misunderstanding James Kuyper <jameskuyper@verizon.net> - 2015-11-25 11:37 -0500
                    Re: qsort() function misunderstanding Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-25 17:36 +0000
    Re: qsort() function misunderstanding Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-24 03:30 -0800
      Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-24 03:48 -0800
        Re: qsort() function misunderstanding Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-24 06:29 -0800
      pre/post increments (was Re: qsort() function misunderstanding) Ken Brody <kenbrody@spamcop.net> - 2015-11-24 09:55 -0500
    Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-24 06:06 -0800
    Re: qsort() function misunderstanding Barry Schwarz <schwarzb@dqel.com> - 2015-11-24 07:33 -0800
    Re: qsort() function misunderstanding Keith Thompson <kst-u@mib.org> - 2015-11-24 09:04 -0800
      Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-24 17:17 +0000
        Re: qsort() function misunderstanding Geoff <geoff@invalid.invalid> - 2015-11-24 10:03 -0800
          Re: qsort() function misunderstanding Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-24 13:31 -0500
            Re: qsort() function misunderstanding Geoff <geoff@invalid.invalid> - 2015-11-24 12:34 -0800
              Re: qsort() function misunderstanding Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-24 16:02 -0500
                Re: qsort() function misunderstanding supercat@casperkitty.com - 2015-11-24 15:18 -0800
                  Re: qsort() function misunderstanding Chad <cdalten@gmail.com> - 2015-11-24 16:15 -0800
                    Re: qsort() function misunderstanding Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-24 23:51 -0800
              Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-25 01:01 -0800
                Re: qsort() function misunderstanding glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-25 12:53 +0000
                  Re: qsort() function misunderstanding supercat@casperkitty.com - 2015-11-25 10:15 -0800
                    Re: qsort() function misunderstanding glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-25 23:14 +0000
                      Re: qsort() function misunderstanding supercat@casperkitty.com - 2015-11-25 16:33 -0800
                        Re: qsort() function misunderstanding glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-26 08:18 +0000
        Re: qsort() function misunderstanding Ian Collins <ian-news@hotmail.com> - 2015-11-25 10:41 +1300
          Re: qsort() function misunderstanding Richard Heathfield <rjh@cpax.org.uk> - 2015-11-24 22:08 +0000
      Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-25 00:53 -0800
    Re: qsort() function misunderstanding Alla _ <modelling.data@gmail.com> - 2015-11-25 09:07 -0800

Page 1 of 3  [1] 2 3  Next page →


#77065 — qsort() function misunderstanding

FromAlla _ <modelling.data@gmail.com>
Date2015-11-24 01:48 -0800
Subjectqsort() function misunderstanding
Message-ID<f2f0bab8-fada-4d3c-a73e-75bd83097970@googlegroups.com>
Hello!

Please, help me to understand the qsort function, which I publish below
my walkthrough. I have a few questions but I will ask them gradually, in
a hope that some might become clear on the way. 

Consider an array v[] = {8,1,10,7,5}

    void qsort(int v[], int left, int right)

1. Before entering the body of the function, I have to choose values 
for left and right. Let left = 0, right = 2.

2. First if condition doesn't hold, therefore the program moves further.
if (left >= right) 
    return;

3. swap(v, left, (left + right)/2)
By calling swap() function the program swaps v[0] and v[2].
The array now looks this way: {10,1,8,7,5}

4. The program assigns 0 (value of left) to variable last.

5. For loop starts first iteration from i = left + 1 = 1, and iterates
until i = 2
   for (i = left+1; i <= right; i++)
6. Condition in the body of the loop checks if the value at v[i], i.e. v[1]
at the first iteration, is less than the value of v[left], i.e. v[0].

Yes, it is; therefore these values should be swapped:
if (v[i] < v[left])
    swap(v, ++last, i);
Given last = left, the argument ++last passed to the swap function, implies
that last has been incremented before used by the function. Is it a correct
assumption? If last has been incremented by one, then this swap function 
doesn't seem to make sense, because it will intent to swap one element at
v[1] (++last would equal 1).

Is my assumption about ++last incorrect?

void qsort(int v[], int left, int right)
{
    int i, last;
    void swap(int v[], int i, int j);

    if (left >= right) /* do nothing if array contains */
        return;        /* fewer than two elements; left and right are indeces */

    swap(v, left, (left + right)/2); /* move partition elem to v[O]*/

    last = left;

    for (i = left+1; i <= right; i++) /* partition */
        if (v[i] < v[left])
            swap(v, ++last, i);

    swap(v, left, last); /* restore partition elem */
    qsort(v, left, last-1);
    qsort(v, last+1, right);
}

void swap (int v[], int i, int j)
{
    int temp;

    temp = v[i];
    v[i] = v[j];
    v[j] = temp;
}

Thank you!

[toc] | [next] | [standalone]


#77073

FromRichard Heathfield <rjh@cpax.org.uk>
Date2015-11-24 10:32 +0000
Message-ID<n31e7n$pbp$2@dont-email.me>
In reply to#77065
On 24/11/15 09:48, Alla _ wrote:
> Hello!
>
> Please, help me to understand the qsort function

No. And it's for your own good.

You have yet to grasp simple control flow. There is no way you are ready 
for function pointers.

Back to Chapter 1 with you. You will be a better programmer for it.

(But somehow, I don't think you're listening - and consequently you are 
becoming the kind of programmer who would build a house using only an 
axe and a hammer.)

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

[toc] | [prev] | [next] | [standalone]


#77076

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2015-11-24 11:08 +0000
Message-ID<87y4dnirid.fsf@bsb.me.uk>
In reply to#77073
Richard Heathfield <rjh@cpax.org.uk> writes:

> On 24/11/15 09:48, Alla _ wrote:
>>
>> Please, help me to understand the qsort function
>
> No. And it's for your own good.
>
> You have yet to grasp simple control flow. There is no way you are
> ready for function pointers.

Did you read the post?  Not a function pointer object in sight.

<snip>
-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#77083

FromRichard Heathfield <rjh@cpax.org.uk>
Date2015-11-24 12:03 +0000
Message-ID<n31jia$d56$1@dont-email.me>
In reply to#77076
On 24/11/15 11:08, Ben Bacarisse wrote:
> Richard Heathfield <rjh@cpax.org.uk> writes:
>
>> On 24/11/15 09:48, Alla _ wrote:
>>>
>>> Please, help me to understand the qsort function
>>
>> No. And it's for your own good.
>>
>> You have yet to grasp simple control flow. There is no way you are
>> ready for function pointers.
>
> Did you read the post?

Not all of it, no. :-)

> Not a function pointer object in sight.

[On re-reading] True. Nevertheless, I stand by my point, in the sense 
that Alla needs to rewind right back to Chapter 1, and spend more time 
grasping the basics, rather than ploughing on at such a tremendous speed 
that she skips over important details.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

[toc] | [prev] | [next] | [standalone]


#77104

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2015-11-24 16:12 +0000
Message-ID<87poyzidfj.fsf@bsb.me.uk>
In reply to#77083
Richard Heathfield <rjh@cpax.org.uk> writes:

> On 24/11/15 11:08, Ben Bacarisse wrote:
>> Richard Heathfield <rjh@cpax.org.uk> writes:
>>
>>> On 24/11/15 09:48, Alla _ wrote:
>>>>
>>>> Please, help me to understand the qsort function
>>>
>>> No. And it's for your own good.
>>>
>>> You have yet to grasp simple control flow. There is no way you are
>>> ready for function pointers.
>>
>> Did you read the post?
>
> Not all of it, no. :-)
>
>> Not a function pointer object in sight.
>
> [On re-reading] True. Nevertheless, I stand by my point, in the sense
> that Alla needs to rewind right back to Chapter 1, and spend more time
> grasping the basics, rather than ploughing on at such a tremendous
> speed that she skips over important details.

I accept that, but I disagree; I think the function presented was very
simple (though, I'd handle the pivot slightly differently myself).  It
won't appear so if Alla has no one to explain how to reason about
functions like this, but that's another matter.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#77078

FromAlla _ <modelling.data@gmail.com>
Date2015-11-24 03:33 -0800
Message-ID<db2c4c95-a083-4b51-b4f2-a331a47adb76@googlegroups.com>
In reply to#77073
On Tuesday, November 24, 2015 at 2:32:57 PM UTC+4, Richard Heathfield wrote:
> On 24/11/15 09:48, Alla _ wrote:
> > Hello!
> >
> > Please, help me to understand the qsort function
> 
> No. And it's for your own good.
> 
> You have yet to grasp simple control flow. There is no way you are ready 
> for function pointers.
> 
> Back to Chapter 1 with you. You will be a better programmer for it.
> 
> (But somehow, I don't think you're listening - and consequently you are 
> becoming the kind of programmer who would build a house using only an 
> axe and a hammer.)
> 
> -- 
> Richard Heathfield
> Email: rjh at cpax dot org dot uk
> "Usenet is a strange place" - dmr 29 July 1999
> Sig line 4 vacant - apply within

Richard, I understand and know that you have only best intentions,
and I am very very thankful to you, and to everyone who is helping me here,
as I said many times, and I believe that all of you know how deeply and
sincerely thankful I am.

Please, allow me to reiterate: I am doing the CS50 course, which is the 
introductory course (I do not have a habit of highlighting the text, but 
I am sure that you see the important word). It gives a broad idea of the 
subject, and introduces a student to main concepts. Only upon finishing 
this course, a student gets further and deeper into subjects by taking 
other courses, which are designed to develop profound skills. Therefore
a student cannot become a programmer upon finishing this course, and this 
is not my goal. I am not a kid, sometimes unfortunately already far from
being the one. I understand that you have your own vision, which I do
respect and which I do my best to heed to, and I try to follow your advises
if I am capable to. I have too many limitations now, which I am not discussing 
here;
and I am not as smart as it requires to be able to grasp the programming 
material, and be a nice partner in conversations in this group. You know it, and you have seen it, but you still tried to help, and I am very thankful for
that. 
It's your choice, if you opt out from helping me further. But I would be 
grateful if other members continue helping me - I have learned a lot, and 
I am doing my best to improve, and not to ask too many vexing questions.
  

[toc] | [prev] | [next] | [standalone]


#77084

FromRichard Heathfield <rjh@cpax.org.uk>
Date2015-11-24 12:05 +0000
Message-ID<n31jmk$d56$2@dont-email.me>
In reply to#77078
On 24/11/15 11:33, Alla _ wrote:

<snip>

> It's your choice, if you opt out from helping me further.

I *am* helping you, if you could only see it. You are going TOO FAST. 
The very best way I can help you is to attempt to persuade you not only 
to slow down, but to re-visit the huge amount of material that you have 
skipped lightly over.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

[toc] | [prev] | [next] | [standalone]


#77090

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2015-11-24 13:52 +0000
Message-ID<n31q3q$une$1@speranza.aioe.org>
In reply to#77084
Richard Heathfield <rjh@cpax.org.uk> wrote:
> On 24/11/15 11:33, Alla _ wrote:
 
> <snip>
 
>> It's your choice, if you opt out from helping me further.
 
> I *am* helping you, if you could only see it. You are going TOO FAST. 
> The very best way I can help you is to attempt to persuade you not only 
> to slow down, but to re-visit the huge amount of material that you have 
> skipped lightly over.

I think I agree, at least a little bit, with Richard.

For one, most people learning C have learned other languages first.
(There might have been some years where it was a popular first
language, but not so much.)

There are many things to learn about computing separate from
learning about C. You are trying to learn them both at once,
and some parts of C are not so easy to learn.

-- glen

[toc] | [prev] | [next] | [standalone]


#77100

FromKen Brody <kenbrody@spamcop.net>
Date2015-11-24 10:01 -0500
Message-ID<n31tvb$loh$1@dont-email.me>
In reply to#77090
On 11/24/2015 8:52 AM, glen herrmannsfeldt wrote:
[...]
> For one, most people learning C have learned other languages first.
> (There might have been some years where it was a popular first
> language, but not so much.)
[...]

My first programming language was Dartmouth BASIC.  ("Basic BASIC", first 
edition -- 0961834609.)  Fortunately, it didn't scar me for life.

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#77091

FromAlla _ <modelling.data@gmail.com>
Date2015-11-24 06:04 -0800
Message-ID<3e774978-389a-456f-a89f-9bcb41fee6a8@googlegroups.com>
In reply to#77084
<snip>

I do see that you are helping, and I have said that. I do understand when you, 
and in fact everyone else in this brilliant community of high professionals, 
say that I am going to fast. I think, though, it's a wrong wording: I am going
too slow, because of my inability to understand things (anyone would already
become at least a reasonably good programmer given the amount of time I have 
already invested into learning); the question is not how to slow down but how 
to increase the quality of my learning processes, and to understand what I 
don't understand for now; and what exactly is that I don't understand. 

Therefore, I am now reading K$R, making ginormous amount of notes, and.. well,
I won't indulge in describing my tactics, it's not interesting - everyone has
his own way for achieving results. Given absence of any, even slight, technical
and math background, learning programming and cs on my own, without a teacher,
is indeed a great challenge. 

I am happy I have discovered this community.

[toc] | [prev] | [next] | [standalone]


#77095

FromRichard Heathfield <rjh@cpax.org.uk>
Date2015-11-24 14:16 +0000
Message-ID<n31rbi$b0b$1@dont-email.me>
In reply to#77091
On 24/11/15 14:04, Alla _ wrote:
> <snip>
>
> I do see that you are helping, and I have said that. I do understand when you,
> and in fact everyone else in this brilliant community of high professionals,
> say that I am going to fast. I think, though, it's a wrong wording: I am going
> too slow, because of my inability to understand things (anyone would already
> become at least a reasonably good programmer given the amount of time I have
> already invested into learning);

No, I don't think that's true. You are still in the very early stages of 
learning, and you are trying to drive yourself too fast. You have an 
exaggerated opinion of how quickly other people learn this stuff, and 
you are hurting your education by attempting to measure up to an 
impossible standard.

> the question is not how to slow down but how
> to increase the quality of my learning processes, and to understand what I
> don't understand for now; and what exactly is that I don't understand.

You can increase the quality of your learning processes by paying more 
attention to the advice you are getting.

> Therefore, I am now reading K$R, making ginormous amount of notes, and.. well,
> I won't indulge in describing my tactics, it's not interesting - everyone has
> his own way for achieving results. Given absence of any, even slight, technical
> and math background, learning programming and cs on my own, without a teacher,
> is indeed a great challenge.

You have a whole newsgroup full of teachers, but you are (mostly) 
ignoring them.

> I am happy I have discovered this community.

So am I, but you'll get more from this community if you pay more 
attention to the advice you are receiving.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

[toc] | [prev] | [next] | [standalone]


#77087

FromJames Kuyper <jameskuyper@verizon.net>
Date2015-11-24 07:32 -0500
Message-ID<n31l94$iso$1@dont-email.me>
In reply to#77078
On 11/24/2015 06:33 AM, Alla _ wrote:
...
> Please, allow me to reiterate: I am doing the CS50 course, which is the 
> introductory course (I do not have a habit of highlighting the text, but 
> I am sure that you see the important word). It gives a broad idea of the 
> subject, and introduces a student to main concepts. Only upon finishing 
> this course, a student gets further and deeper into subjects by taking 
> other courses, which are designed to develop profound skills. Therefore
> a student cannot become a programmer upon finishing this course, and this 
> is not my goal. I am not a kid, sometimes unfortunately already far from
> being the one. I understand that you have your own vision, which I do
> respect and which I do my best to heed to, and I try to follow your advises
> if I am capable to. I have too many limitations now, which I am not discussing 
> here;
> and I am not as smart as it requires to be able to grasp the programming 
> material, and be a nice partner in conversations in this group. You know it, and you have seen it, but you still tried to help, and I am very thankful for
> that.

Let me put it this way - if the speed with which you are tackling C is
forced upon you by this course, then you are guaranteed to fail this
course. The course work advanced beyond your current ability to
understand C many weeks ago; you cannot reasonably expect to catch up
any time before summer break. I would recommend dropping the class, and
try taking it again the next time it is offered. In the mean time, self
study at a pace that you can actually keep up with.
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#77107

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2015-11-24 16:43 +0000
Message-ID<87k2p7ic01.fsf@bsb.me.uk>
In reply to#77087
James Kuyper <jameskuyper@verizon.net> writes:

> On 11/24/2015 06:33 AM, Alla _ wrote:
> ...
>> Please, allow me to reiterate: I am doing the CS50 course, which is the 
>> introductory course (I do not have a habit of highlighting the text, but 
>> I am sure that you see the important word). It gives a broad idea of the 
>> subject, and introduces a student to main concepts. Only upon finishing 
>> this course, a student gets further and deeper into subjects by taking 
>> other courses, which are designed to develop profound skills. Therefore
>> a student cannot become a programmer upon finishing this course, and this 
>> is not my goal.
<snip>
> Let me put it this way - if the speed with which you are tackling C is
> forced upon you by this course, then you are guaranteed to fail this
> course. The course work advanced beyond your current ability to
> understand C many weeks ago; you cannot reasonably expect to catch up
> any time before summer break. I would recommend dropping the class, and
> try taking it again the next time it is offered. In the mean time, self
> study at a pace that you can actually keep up with.

Here's the course description:

  "Introduction to the intellectual enterprises of computer science and
  the art of programming. This course teaches students how to think
  algorithmically and solve problems efficiently. Topics include
  abstraction, algorithms, data structures, encapsulation, resource
  management, security, software engineering, and web
  development. Languages include C, PHP, and JavaScript plus SQL, CSS,
  and HTML. Problem sets inspired by real-world domains of biology,
  cryptography, finance, forensics, and gaming. Designed for
  concentrators and non-concentrators alike, with or without prior
  programming experience"

It's 12 weeks long with 10 problem sets a project.  The course includes
a taste of lots of topics that are not directly related to programming.
There is no way that anyone taking it is supposed to learn C or learn to
program during it.  The intent (as I see it) is to get a feel for what
various kinds of program look like and to "jump in" and modify some
programs in the problem sets without being any sort of expert.  It's a
though skill that's not at all the same as the methodical and
detail-oriented programming the I think many people here are more
familiar with.  I think it's it's an interesting idea.

I'm not exactly sure how the questions Alla is posting here relate to
the course (and maybe I've go the wrong CS50!) but I suspect she is
trying to understand too much.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#77147

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2015-11-25 05:58 +0000
Message-ID<n33il9$9ru$1@speranza.aioe.org>
In reply to#77107
Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:

(snip of discussion on Alla and learning C)
 
> Here's the course description:
 
>  "Introduction to the intellectual enterprises of computer science and
>  the art of programming. This course teaches students how to think
>  algorithmically and solve problems efficiently. Topics include
>  abstraction, algorithms, data structures, encapsulation, resource
>  management, security, software engineering, and web
>  development. Languages include C, PHP, and JavaScript plus SQL, CSS,
>  and HTML. Problem sets inspired by real-world domains of biology,
>  cryptography, finance, forensics, and gaming. Designed for
>  concentrators and non-concentrators alike, with or without prior
>  programming experience"
 
> It's 12 weeks long with 10 problem sets a project.  The course includes
> a taste of lots of topics that are not directly related to programming.

Seems to me that many people believe that CS is the same as
programming. But there are many more things that are part of CS,
and it looks like this course covers many of them.

> There is no way that anyone taking it is supposed to learn C or learn to
> program during it.  The intent (as I see it) is to get a feel for what
> various kinds of program look like and to "jump in" and modify some
> programs in the problem sets without being any sort of expert.  It's a
> though skill that's not at all the same as the methodical and
> detail-oriented programming the I think many people here are more
> familiar with.  I think it's it's an interesting idea.
 
> I'm not exactly sure how the questions Alla is posting here relate to
> the course (and maybe I've go the wrong CS50!) but I suspect she is
> trying to understand too much.

I suppose, but how many of us have ever taken a course where we
didn't know as much as we should have before taking it?

So, you try to learn as much as you can, in the time you have.

Even if you don't learn everything, when you see it again later
you will learn it much faster. 

But yes, I suspect that students for a class like this should
know a good amount about programming, first. Is there a 
prerequisite for it?

-- glen

[toc] | [prev] | [next] | [standalone]


#77155

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2015-11-25 11:34 +0000
Message-ID<87a8q2ia87.fsf@bsb.me.uk>
In reply to#77147
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
<snip>
> I suppose, but how many of us have ever taken a course where we
> didn't know as much as we should have before taking it?
>
> So, you try to learn as much as you can, in the time you have.
>
> Even if you don't learn everything, when you see it again later
> you will learn it much faster.

Yes, but there is a problem some students run into of needing to
understand at a level that is either impractical or philosophically
impossible.  Either they need to fully understand (whatever that means!)
at every step before moving on, or they feel that they don't really
understand something because they only know how to use it, but not what
it *really is.  A key skill to learning (at least a university level) is
to be content with not understanding things.

We never really understand anything.  When I was learning programming I
picked up recursion from a book on LISP and thought I understood it.  It
was only at university that I started to realise that I didn't, but also
that that didn't matter much provided I could use it to do the
exercises.  I've kept on learning about recursion and I doubt it will
ever end, except as everything ends.  I certainly hope not.

> But yes, I suspect that students for a class like this should
> know a good amount about programming, first. Is there a 
> prerequisite for it?

No.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#77158

FromRichard Heathfield <rjh@cpax.org.uk>
Date2015-11-25 12:45 +0000
Message-ID<n34ac3$s71$1@dont-email.me>
In reply to#77155
On 25/11/15 11:34, Ben Bacarisse wrote:

<snip>

> I've kept on learning about recursion and I doubt it will
> ever end

That's because you forgot your base case.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

[toc] | [prev] | [next] | [standalone]


#77207

FromAlla _ <modelling.data@gmail.com>
Date2015-11-26 02:18 -0800
Message-ID<0227cbc2-95f6-49c0-8ab2-e166e95c3fce@googlegroups.com>
In reply to#77158
Richard, 

I have just came across the gold mine, which I didn't know about. Although
I am not intending to check solutions before trying to solve any exercise
myself, I am happy to have this page to fall back on at hard times ) 
I am not sure if you promote any of your pages, but I hope I am not violating
any rules, or your intentions, by posting the link here

http://www.eng.uerj.br/~fariasol/disciplinas/LABPROG/C_language/Kernighan_and_Ritchie/solved-exercises/solved-exercises.html/

[toc] | [prev] | [next] | [standalone]


#77208

FromRichard Heathfield <rjh@cpax.org.uk>
Date2015-11-26 10:45 +0000
Message-ID<n36nnv$6hi$1@dont-email.me>
In reply to#77207
On 26/11/15 10:18, Alla _ wrote:
> Richard,
>
> I have just came across the gold mine, which I didn't know about. Although
> I am not intending to check solutions before trying to solve any exercise
> myself, I am happy to have this page to fall back on at hard times )
> I am not sure if you promote any of your pages, but I hope I am not violating
> any rules, or your intentions, by posting the link here
>
> http://www.eng.uerj.br/~fariasol/disciplinas/LABPROG/C_language/Kernighan_and_Ritchie/solved-exercises/solved-exercises.html/

Interesting. Not my site, but obviously an archive of a site I used to 
run. At some point, I handed over editorial control of those solutions 
to the comp.lang.c wiki. You can find it here:

http://clc-wiki.net/wiki/K%26R2_solutions

Be aware, though, that anyone can update a wiki, so some of the 
solutions may have become broken over the years.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

[toc] | [prev] | [next] | [standalone]


#77163

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2015-11-25 14:46 +0000
Message-ID<n34hjf$or5$1@speranza.aioe.org>
In reply to#77155
Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
<snip, I wrote>
>> I suppose, but how many of us have ever taken a course where we
>> didn't know as much as we should have before taking it?

>> So, you try to learn as much as you can, in the time you have.

>> Even if you don't learn everything, when you see it again later
>> you will learn it much faster.
 
> Yes, but there is a problem some students run into of needing to
> understand at a level that is either impractical or philosophically
> impossible.  Either they need to fully understand (whatever that means!)
> at every step before moving on, or they feel that they don't really
> understand something because they only know how to use it, but not what
> it *really is.  A key skill to learning (at least a university level) is
> to be content with not understanding things.

There is a quote from famous physicist Richard Feynman at the beginning
of Michael Chichton's book "Timeline".

    "Nobody understands quantum mechanics."

Since he understood it likely better than anyone else, 
he should know.  But even though we don't understand, we
still work and learn.
 
> We never really understand anything.  When I was learning programming I
> picked up recursion from a book on LISP and thought I understood it.  It
> was only at university that I started to realise that I didn't, but also
> that that didn't matter much provided I could use it to do the
> exercises.  I've kept on learning about recursion and I doubt it will
> ever end, except as everything ends.  I certainly hope not.

About in my college years, I figured out that the US system
(no idea about other countries) doesn't expect you to understand
something the first time you are taught, but it does for the
second time. The problem is knowing when it is the second time.

There is the old favorite question students ask teachers:

   "will this be on the test?"

The purpose of school is to learn, not to get good grades.
(Grades are supposed to tell how well you learned, but they
don't always do that.)

If you come out learning everything but with poor grades, you
will do better than someone who didn't learn but got good grades.
(Likely because the latter cheated.)

You don't have to know everything, but it helps to know that you
don't know something, and where to look to find out.

>> But yes, I suspect that students for a class like this should
>> know a good amount about programming, first. Is there a 
>> prerequisite for it?
 
> No.

-- glen

[toc] | [prev] | [next] | [standalone]


#77151

FromAlla _ <modelling.data@gmail.com>
Date2015-11-25 00:51 -0800
Message-ID<d050dd54-ba0b-4ab8-b742-28227bdfe018@googlegroups.com>
In reply to#77107
On Tuesday, November 24, 2015 at 8:43:57 PM UTC+4, Ben Bacarisse wrote:
> James Kuyper <jameskuyper@verizon.net> writes:
> 
> > On 11/24/2015 06:33 AM, Alla _ wrote:
> > ...
> >> Please, allow me to reiterate: I am doing the CS50 course, which is the 
> >> introductory course (I do not have a habit of highlighting the text, but 
> >> I am sure that you see the important word). It gives a broad idea of the 
> >> subject, and introduces a student to main concepts. Only upon finishing 
> >> this course, a student gets further and deeper into subjects by taking 
> >> other courses, which are designed to develop profound skills. Therefore
> >> a student cannot become a programmer upon finishing this course, and this 
> >> is not my goal.
> <snip>
> > Let me put it this way - if the speed with which you are tackling C is
> > forced upon you by this course, then you are guaranteed to fail this
> > course. The course work advanced beyond your current ability to
> > understand C many weeks ago; you cannot reasonably expect to catch up
> > any time before summer break. I would recommend dropping the class, and
> > try taking it again the next time it is offered. In the mean time, self
> > study at a pace that you can actually keep up with.
> 
> Here's the course description:
> 
>   "Introduction to the intellectual enterprises of computer science and
>   the art of programming. This course teaches students how to think
>   algorithmically and solve problems efficiently. Topics include
>   abstraction, algorithms, data structures, encapsulation, resource
>   management, security, software engineering, and web
>   development. Languages include C, PHP, and JavaScript plus SQL, CSS,
>   and HTML. Problem sets inspired by real-world domains of biology,
>   cryptography, finance, forensics, and gaming. Designed for
>   concentrators and non-concentrators alike, with or without prior
>   programming experience"
> 
> It's 12 weeks long with 10 problem sets a project.  The course includes
> a taste of lots of topics that are not directly related to programming.
> There is no way that anyone taking it is supposed to learn C or learn to
> program during it.  The intent (as I see it) is to get a feel for what
> various kinds of program look like and to "jump in" and modify some
> programs in the problem sets without being any sort of expert.  It's a
> though skill that's not at all the same as the methodical and
> detail-oriented programming the I think many people here are more
> familiar with.  I think it's it's an interesting idea.
> 
> I'm not exactly sure how the questions Alla is posting here relate to
> the course (and maybe I've go the wrong CS50!) but I suspect she is
> trying to understand too much.
> 
> -- 
> Ben.

Ben, thank you very much. You are the only one who did actually understand 
the idea of the course, and what it gives one. And, yes, I am trying to 
understand more than is required, because I would feel more comfortable 
doing the majority of problems discussed at the course, if I have a 
better knowledge on C - that is my choice. 
Indeed, this group is a community of highly professional people who do have
their own vision on different matters, and, unfortunately, not always happy to
consider different approaches and vision. I do respect and understand that. 

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.lang.c


csiph-web