Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Assignment 2 Q2 & Q3 August 23, 2010 12:20PM |
Registered: 16 years ago Posts: 68 Rating: 0 |
Re: Assignment 2 Q2 & Q3 August 23, 2010 01:17PM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Assignment 2 Q2 & Q3 August 24, 2010 02:59AM |
Registered: 15 years ago Posts: 34 Rating: 0 |
Language: C++******************************************* Binary search algorithm for all types ******************************************* 5 6 8 12 15 21 25 31 ========================= Searcing for the integer 27 ========================= Element not found! ========================= Searcing for the integer 15 ========================= The element was found at position 5 in the array. Process returned 0 (0x0) execution time : 0.044 s Press any key to continue.
Language: C++******************************************** Sort algorithms sorting an array of integers ******************************************** =============== Insertion sort. =============== Unsorted array - 18 15 11 4 2 9 10 5 3 12 6 7 18 15 11 4 2 9 10 5 3 12 6 7 Shuffle 15 into place : 15 18 11 4 2 9 10 5 3 12 6 7 15 18 11 4 2 9 10 5 3 12 6 7 15 18 18 4 2 9 10 5 3 12 6 7 Shuffle 11 into place : 11 15 18 4 2 9 10 5 3 12 6 7 11 15 18 4 2 9 10 5 3 12 6 7 11 15 18 18 2 9 10 5 3 12 6 7 11 15 15 18 2 9 10 5 3 12 6 7 Shuffle 4 into place : 4 11 15 18 2 9 10 5 3 12 6 7 4 11 15 18 2 9 10 5 3 12 6 7 4 11 15 18 18 9 10 5 3 12 6 7 4 11 15 15 18 9 10 5 3 12 6 7 4 11 11 15 18 9 10 5 3 12 6 7 Shuffle 2 into place : 2 4 11 15 18 9 10 5 3 12 6 7 2 4 11 15 18 9 10 5 3 12 6 7 2 4 11 15 18 18 10 5 3 12 6 7 2 4 11 15 15 18 10 5 3 12 6 7 Shuffle 9 into place : 2 4 9 11 15 18 10 5 3 12 6 7 2 4 9 11 15 18 10 5 3 12 6 7 2 4 9 11 15 18 18 5 3 12 6 7 2 4 9 11 15 15 18 5 3 12 6 7 Shuffle 10 into place : 2 4 9 10 11 15 18 5 3 12 6 7 2 4 9 10 11 15 18 5 3 12 6 7 2 4 9 10 11 15 18 18 3 12 6 7 2 4 9 10 11 15 15 18 3 12 6 7 2 4 9 10 11 11 15 18 3 12 6 7 2 4 9 10 10 11 15 18 3 12 6 7 Shuffle 5 into place : 2 4 5 9 10 11 15 18 3 12 6 7 2 4 5 9 10 11 15 18 3 12 6 7 2 4 5 9 10 11 15 18 18 12 6 7 2 4 5 9 10 11 15 15 18 12 6 7 2 4 5 9 10 11 11 15 18 12 6 7 2 4 5 9 10 10 11 15 18 12 6 7 2 4 5 9 9 10 11 15 18 12 6 7 2 4 5 5 9 10 11 15 18 12 6 7 Shuffle 3 into place : 2 3 4 5 9 10 11 15 18 12 6 7 2 3 4 5 9 10 11 15 18 12 6 7 2 3 4 5 9 10 11 15 18 18 6 7 Shuffle 12 into place : 2 3 4 5 9 10 11 12 15 18 6 7 2 3 4 5 9 10 11 12 15 18 6 7 2 3 4 5 9 10 11 12 15 18 18 7 2 3 4 5 9 10 11 12 15 15 18 7 2 3 4 5 9 10 11 12 12 15 18 7 2 3 4 5 9 10 11 11 12 15 18 7 2 3 4 5 9 10 10 11 12 15 18 7 Shuffle 6 into place : 2 3 4 5 6 9 10 11 12 15 18 7 2 3 4 5 6 9 10 11 12 15 18 7 2 3 4 5 6 9 10 11 12 15 18 18 2 3 4 5 6 9 10 11 12 15 15 18 2 3 4 5 6 9 10 11 12 12 15 18 2 3 4 5 6 9 10 11 11 12 15 18 2 3 4 5 6 9 10 10 11 12 15 18 Shuffle 7 into place : 2 3 4 5 6 7 9 10 11 12 15 18 Sorted array(Insertion Sort) - 2 3 4 5 6 7 9 10 11 12 15 18 ============================================================ =========== Quick sort. =========== Unsorted array - 18 15 11 4 2 9 10 5 3 12 6 7 Move Pivot : 9 15 11 4 2 18 10 5 3 12 6 7 Swap 15 & 7: 9 7 11 4 2 18 10 5 3 12 6 15 Swap 11 & 6: 9 7 6 4 2 18 10 5 3 12 11 15 Swap 18 & 3: 9 7 6 4 2 3 10 5 18 12 11 15 Swap 10 & 5: 9 7 6 4 2 3 5 10 18 12 11 15 Move Pivot back : 5 7 6 4 2 3 9 10 18 12 11 15 Move Pivot : 6 7 5 4 2 3 9 10 18 12 11 15 Swap 7 & 3: 6 3 5 4 2 7 9 10 18 12 11 15 Move Pivot back : 2 3 5 4 6 7 9 10 18 12 11 15 Move Pivot : 3 2 5 4 6 7 9 10 18 12 11 15 Move Pivot back : 2 3 5 4 6 7 9 10 18 12 11 15 Move Pivot : 2 3 5 4 6 7 9 10 18 12 11 15 Move Pivot back : 2 3 4 5 6 7 9 10 18 12 11 15 Move Pivot : 2 3 4 5 6 7 9 12 18 10 11 15 Swap 18 & 11: 2 3 4 5 6 7 9 12 11 10 18 15 Move Pivot back : 2 3 4 5 6 7 9 10 11 12 18 15 Move Pivot : 2 3 4 5 6 7 9 10 11 12 18 15 Move Pivot : 2 3 4 5 6 7 9 10 11 12 18 15 Move Pivot back : 2 3 4 5 6 7 9 10 11 12 15 18 Sorted array(Quick Sort) - 2 3 4 5 6 7 9 10 11 12 15 18 ============================================================ =========== Merge sort. =========== Unsorted array - 18 15 11 4 2 9 10 5 3 12 6 7 18 15 11 4 2 9 10 5 3 12 6 7 15 18 11 4 2 9 10 5 3 12 6 7 11 15 18 4 2 9 10 5 3 12 6 7 11 15 18 2 4 9 10 5 3 12 6 7 11 15 18 2 4 9 10 5 3 12 6 7 2 4 9 11 15 18 10 5 3 12 6 7 2 4 9 11 15 18 5 10 3 12 6 7 2 4 9 11 15 18 3 5 10 12 6 7 2 4 9 11 15 18 3 5 10 6 12 7 2 4 9 11 15 18 3 5 10 6 7 12 2 4 9 11 15 18 3 5 6 7 10 12 Sorted array(Merge Sort) - 2 3 4 5 6 7 9 10 11 12 15 18 ============================================================ Process returned 0 (0x0) execution time : 0.167 s Press any key to continue.
Re: Assignment 2 Q2 & Q3 August 24, 2010 09:08AM |
Registered: 16 years ago Posts: 29 Rating: 0 |
Re: Assignment 2 Q2 & Q3 August 24, 2010 08:16PM |
Registered: 14 years ago Posts: 608 Rating: 0 |
Re: Assignment 2 Q2 & Q3 August 25, 2010 01:04AM |
Registered: 15 years ago Posts: 34 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 03, 2010 09:39PM |
Registered: 14 years ago Posts: 608 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 04, 2010 07:07PM |
Registered: 18 years ago Posts: 4 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 09, 2010 02:08PM |
Registered: 14 years ago Posts: 608 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 10, 2010 01:01PM |
Registered: 18 years ago Posts: 4 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 20, 2010 10:07PM |
Registered: 16 years ago Posts: 1,268 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 21, 2010 12:40PM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Assignment 2 Q2 & Q3 September 21, 2010 08:40PM |
Registered: 16 years ago Posts: 1,268 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 12:24AM |
Registered: 16 years ago Posts: 1,268 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 12:24AM |
Registered: 16 years ago Posts: 1,268 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 10:24AM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 10:33AM |
Registered: 16 years ago Posts: 1,268 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 12:08PM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 02:17PM |
Registered: 16 years ago Posts: 1,268 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 08:57PM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Assignment 2 Q2 & Q3 September 22, 2010 09:45PM |
Registered: 16 years ago Posts: 1,268 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 23, 2010 11:11AM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Assignment 2 Q2 & Q3 September 28, 2010 08:13AM |
Registered: 14 years ago Posts: 608 Rating: 0 |
Re: Assignment 2 Q2 & Q3 September 28, 2010 11:14AM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |