Turn on thread page Beta
    • Thread Starter
    Offline

    12
    ReputationRep:
    How do these sorting algorithms work when there are more than one of a certain number.

    eg sort: 8, 6, 7, 5, 9, 4, 3, 6, 5, 6
    Offline

    0
    ReputationRep:
    (Original post by ssmoose)
    How do these sorting algorithms work when there are more than one of a certain number.

    eg sort: 8, 6, 7, 5, 9, 4, 3, 6, 5, 6
    Bubble sort: When you come to a bubble containing two identical numbers, leave them as they are (obviously).

    Quick Sort: Same as above I guess, because when you take a pivot and put the numbers on either side, you order them all from right to left anyway. If this leaves you with a sub-list containing only repeated numbers (e.g. Li: [5, 5]) then it doesn't really matter which side you take it to.

    I'm surprised that Heinemann books etc. (if you have them) don't say anything about this. Because it's important that you use the algorithm exactly correctly, I'd get some clarification from a teacher
    • Thread Starter
    Offline

    12
    ReputationRep:
    That's the problem I'm teaching it and S1 to myself as a backup incase the big ones (M5/FP3) don't work out too well. Cheers for the advice, and it is the heinemann ones I'm using
    Offline

    2
    ReputationRep:
    (Original post by ssmoose)
    How do these sorting algorithms work when there are more than one of a certain number.

    eg sort: 8, 6, 7, 5, 9, 4, 3, 6, 5, 6
    The essential feature of an algorithm is that (provided that the starting data is set up correctly) you just follow the instructions! If anything goes wrong,

    either

    * you haven't followed the algorithm correctly
    * the algorithm contains an error.

    Aitch
    Offline

    3
    ReputationRep:
    Once u sorted it out, any question telling u to sort these numbers in ascending/descending order, the algorithm will always work.
    Offline

    2
    ReputationRep:
    (Original post by ssmoose)
    That's the problem I'm teaching it and S1 to myself as a backup incase the big ones (M5/FP3) don't work out too well. Cheers for the advice, and it is the heinemann ones I'm using
    I've taught myself D1 and D2 [Heinemann]. [Also FP1 & FP2 & M3 - more scary!] If you get stuck, post the problems, there are quite a few of us who can help.

    Aitch
    Offline

    2
    ReputationRep:
    (Original post by JohnSPals)

    I'm surprised that Heinemann books etc. (if you have them) don't say anything about this. Because it's important that you use the algorithm exactly correctly, I'd get some clarification from a teacher
    There are other examples like this one that you might like to be aware of!

    Link to the list is at the end of this article:

    http://www.thestudentroom.co.uk/article.php?a=45

    Aitch
 
 
 
Turn on thread page Beta
Updated: July 12, 2005

University open days

  • Heriot-Watt University
    School of Textiles and Design Undergraduate
    Fri, 16 Nov '18
  • University of Roehampton
    All departments Undergraduate
    Sat, 17 Nov '18
  • Edge Hill University
    Faculty of Health and Social Care Undergraduate
    Sat, 17 Nov '18
Poll
Black Friday: Yay or Nay?
Useful resources

Make your revision easier

Maths

Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

Equations

How to use LaTex

Writing equations the easy way

Equations

Best calculators for A level Maths

Tips on which model to get

Student revising

Study habits of A* students

Top tips from students who have already aced their exams

Study Planner

Create your own Study Planner

Never miss a deadline again

Polling station sign

Thinking about a maths degree?

Chat with other maths applicants

Can you help? Study help unanswered threads

Groups associated with this forum:

View associated groups

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.