Author Message

I am writing a Pascal exam on monday and I really don't understand how all
the searches and sorting methods work, could someone, ANYONE please explain
them to me without the use of procedures with parameters.....

Thanks sooo much
GH

Wed, 18 Jun 1902 08:00:00 GMT
Quote:

> I am writing a pascal exam on monday and I really don't understand how all
> the searches and sorting methods work, could someone, ANYONE please explain
> them to me without the use of procedures with parameters.....

Some of the methods used, e.g. quicksort, pretty much require procedures
with parameters to work in general, although for limited cases you may
be able to find a parameter-free kludge...

It would also help if you knew exactly which methods you wanted
explained. All sorting and searching methods, if explained, would have
you reading the advice far beyond Monday. Whole books have been written
on the subject.

Al Moore

Wed, 18 Jun 1902 08:00:00 GMT
Sorting basically comes down to putting things in order.  Suppose I handed you
a shuffled deck of cards, and said "Put these in order"; alternatively, suppose
I gave you a list of names and said "Alphabetize these".  Think about the steps
you take, write them down, and call this an "algorithm".  Now translate your
algorithm into Pascal, thinking about not only the steps but the data
structures you need.  [I've buried the title of quite a good book by a very
good author in the previous sentence].

The searching problem is somewhat related.  I hand you a dictionary, and say
"What is the definition of the word voluble?"  You have to search through the
dictionary to find the word, and can then give me its definition.  How do you
do such a search?  How would you do it if the information were, instead,
people, and I asked "Whose Social Security Number is 123-45-6789?"?  Again,
think about the data structures, what requirements/restrictions you'd like to
put on the data structures, and what algorithm you'd use to find a piece of
information within the data.  Write down the steps (even better, make a model
and actually DO it -- example, take a deck of cards and play "Find the five of
diamonds" -- this will be an extremely useful exercise for you to do, as it
will teach you several important principles of searching!), translate to
Pascal, and you're done.

[By now, you may have realized that the last step, "translate to Pascal", the
only really Pascal-specific step, is also the simplest, assuming you've been
staying awake in class and reading your textbook.  Figuring out the algorithm,
and designing appropriate data structures, is where the "skill" of programming
comes in ...].

Bob Schor
Pascal Enthusiast

Quote:

> I am writing a pascal exam on monday and I really don't understand how all
> the searches and sorting methods work, could someone, ANYONE please explain
> them to me without the use of procedures with parameters.....

> Thanks sooo much
> GH

Wed, 18 Jun 1902 08:00:00 GMT

Quote:
>I am writing a pascal exam on monday and I really don't understand how all
>the searches and sorting methods work, could someone, ANYONE please explain
>them to me without the use of procedures with parameters.....

Forget sorting and searching. The real issue is that you left the study
of procedures and parameters too late and you need to catch up on these
first. If this means you don't pass your exam on Monday then I'm sorry.
Maybe next time.

Procedures aren't a difficult concept. It's just a case of breaking down

Parameters are just a way of communicating between procedures, either an
immediate data value or a reference to a variable stored elsewhere.

Thu, 01 May 2003 10:38:12 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages