Login

Welcome, Guest. Please login or register.

March 29, 2024, 04:47:58 am

Author Topic: 2014 HSC Past Paper  (Read 1324 times)  Share 

0 Members and 1 Guest are viewing this topic.

clarence.harre

  • Adventurer
  • *
  • Posts: 24
  • Respect: 0
2014 HSC Past Paper
« on: August 15, 2017, 02:27:20 pm »
0
Hey everyone,
I really need help to solve this one question from the 2014 HSC paper (question is attached as an image).

Quick Version: I can't figure out how to produce the answer (D) using any of the 3 sorting methods we're taught

Question: What will the 2nd pass produce?

     Initial: 4 2 8 5 7 1
1st Pass: 4 2 8 5 7 1

My Working:

(Note: Insertion sorts always assume one item is already sorted)
Using Insertion (Moving from left to right)

     Initial: 4 * 2 8 5 7 1
1st Pass: 2 4 * 8 5 7 1
2nd Pass: 2 4 8 * 5 7 1
3rd Pass: 2 4 5 8 * 7 1
4th Pass: 2 4 5 7 8 * 1
LastPass: 1 2 4 5 7 8 *

Using Insertion (Moving from right to left)

     Initial: 4 2 8 5 7 * 1
1st Pass: 2 4 8 5 * 7 1
2nd Pass: 2 4 8 * 7 5 1
3rd Pass: 2 4 * 8 7 5 1
4th Pass: 2 * 8 7 5 4 1
LastPass: * 8 7 5 4 2 1

Therefore, it can't be insertion.

Using selection (moving biggest to left)

     Initial: * 4 2 8 5 7 1
1st Pass: 8 * 2 4 5 7 1
2nd Pass: 8 7 * 4 5 2 1
3rd Pass: 8 7 5 * 4 2 1
4th Pass: 8 7 5 4 * 2 1
LastPass: 8 7 5 4 2 1 *

Using selection (moving smallest to left)

     Initial: * 4 2 8 5 7 1
1st Pass: 1 * 2 8 5 7 4
2nd Pass: 1 2 * 8 5 7 4
3rd Pass: 1 2 4 * 5 7 8
4th Pass: 1 2 4 5 * 7 8
5th Pass: 1 2 4 5 7 * 8
LastPass: 1 2 4 5 7 8 *

Thus, it can't be selection sort.

Using Bubblesort (selecting biggest moving left to right)

Initial:
4 2 8 5 7 1
1st Pass:
[2 4] 8 5 7 1
2 [4 8] 5 7 1
2 4 [5 8] 7 1
2 4 5 [7 8] 1
2 4 5 7 [1 8]

Using Bubblesort (selecting smallest moving left to right)

Initial:
4 2 8 5 7 1
1st Pass:
[4 2] 8 5 7 1
4 [8 2] 5 7 1
4 8 [5 2] 7 1
4 8 5 [7 2] 1
4 8 5 7 [2 1]

Using Bubblesort (selecting biggest moving right to left)

Initial:
4 2 8 5 7 1
1st Pass:
4 2 8 5 [7 1]
4 2 8 [7 5] 1
4 2 [8 7] 5 1
4 [8 2] 7 5 1
[8 4] 2 7 5 1

Using Bubblesort (selecting smallest moving right to left)

Initial:
4 2 8 5 7 1
1st Pass:
4 2 8 5 [1 7]
4 2 8 [1 5] 7
4 2 [1 8] 5 7
4 [1 2] 8 5 7
[1 4] 2 8 5 7


None of them produce 4 2 8 5 7 1 after the first pass. The bubble sort (biggest right to left/smallest left to right) does after the first part of the first pass, but none produce the correct answer for 2nd pass: 8 4 2 5 7 1


Please someone help me out here. I feel like I'm going nuts trying to figure this one out. And it's only worth one mark. Why??!?!?!?
HSC '17: Physics | Chemistry | Software | English (Advanced) | Mathematics 3U | German (Continuers) | Electrotechnology (TVET)

ATAR Goal: 92.50

Aim: USyd (B Engineering - Electrical)

SpanishPear

  • Forum Regular
  • **
  • Posts: 64
  • Respect: +1
Re: 2014 HSC Past Paper
« Reply #1 on: February 07, 2018, 08:57:48 am »
0
I must admit, I have been trying to work this out for like 30 minutes now, and i just reallised, its a SELECTION SORT moving the smallest TO THE RIGHT!!

Opengangs

  • New South Welsh
  • Forum Leader
  • ****
  • Posts: 718
  • \(\mathbb{O}_\mathbb{G}\)
  • Respect: +480
Re: 2014 HSC Past Paper
« Reply #2 on: February 07, 2018, 09:02:40 am »
+1
I must admit, I have been trying to work this out for like 30 minutes now, and i just reallised, its a SELECTION SORT moving the smallest TO THE RIGHT!!

There might have been a typo in D because I managed to get the rest in order (the 7 and 5 need to be switched though) using bubble sort.