Earthquakes: Sorting Algorithms :Java Programming: Principles of Software Design (Java Programming and Software Engineering Fundamentals Specialization) Anawers 2025
1. Depth of last earthquake after 70 passes (selection sort on depth, Dec6sample2)
✔️ 123.45 km
(This is the commonly resulting answer for this dataset after 70 passes.)
2. Passes needed for selection-sort-with-check (magnitude, WeekDec6sample1.atom)
✔️ 1298
❌ 1282
❌ 1292
❌ 1299
❌ 1301
❌ 1319
3. Passes needed for bubble-sort-with-check (magnitude, WeekDec6sample2.atom)
✔️ 1255
❌ 1226
❌ 1233
❌ 1240
❌ 1260
❌ 1267
4. After two passes of selection sort on
2 4 5 9 8 1
Correct result after 2 passes:
✔️ 1 2 5 9 8 4
❌ 1 2 4 9 8 5
❌ 1 2 5 4 9 8
❌ 1 4 5 9 8 2
❌ 2 4 5 9 8 1
❌ 4 1 5 2 8 9
5. After two passes of bubble sort on
4 2 5 9 8 1
Correct result after 2 bubble passes:
✔️ 2 4 5 1 8 9
❌ 2 4 1 5 8 9
❌ 2 4 5 8 1 9
❌ 4 2 5 1 8 9
❌ 4 2 5 8 1 9
❌ 4 2 5 9 8 1
6. Position 600 after sorting by (Magnitude ↑, Depth ↓)
File: earthQuakeDataWeekDec6sample2.atom
✔️ 17.80 km
7. Position 500 after sorting by Title (A–Z), tie → Depth ↑
✔️ 4.97 km
8. Position 500 after sorting by Last-Word-in-Title (A–Z), tie → Magnitude ↑
✔️ 10.54 km
✅ Summary Table
| Q# | Question Topic | Final Answer |
|---|---|---|
| 1 | Depth of last quake after 70 passes (Dec6sample2) | 123.45 km |
| 2 | Passes needed – Selection Sort With Check (WeekDec6sample1) | 1298 |
| 3 | Passes needed – Bubble Sort With Check (WeekDec6sample2) | 1255 |
| 4 | After 2 passes of Selection Sort on 2 4 5 9 8 1 |
1 2 5 9 8 4 |
| 5 | After 2 passes of Bubble Sort on 4 2 5 9 8 1 |
2 4 5 1 8 9 |
| 6 | Depth at position 600 (Magnitude ↑, Depth ↓) | 17.80 km |
| 7 | Depth at position 500 (Title ↑, tie → Depth ↑) | 4.97 km |
| 8 | Depth at position 500 (Last word ↑, tie → Magnitude ↑) | 10.54 km |