Welcome! Log In Create A New Profile

Advanced

Assignment 03Q4

Posted by united 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Assignment 03Q4
June 01, 2007 08:25PM
Has everyone finished assignment 3? It seems that no one is having any problem as there are no posts on it. Can anyone tell me how to appraoch question 4 on bublesort. any tip will be much appreciated.Goodluck.
Re: Assignment 03Q4
June 01, 2007 08:51PM
I think the question should rather be - has anyone started with assignment 3.
Sorry mate, not there yet. Still caught up with deadlines in other modules.
Re: Assignment 03Q4
June 01, 2007 08:53PM
Tried googling Bubble Sort - there are plenty enough articles out there on sorting.
Re: Assignment 03Q4
June 04, 2007 08:08AM
Try figuring it out first, then if you really cant then google it. Cuz if you just google it then you miss the oppurtunity to lear.
Anonymous User
Re: Assignment 03Q4
June 07, 2007 08:42AM
hello..ya i finished the question in bubble sort..if u still need help let me know winking smiley
Anonymous User
Re: Assignment 03Q4
June 07, 2007 08:42AM
hello..ya i finished the question on bubble sort..if u still need help let me know winking smiley
Re: Assignment 03Q4
June 10, 2007 05:12PM
Last year one of my prescribed books were "Foundations of Computer Science" by Forouzan (Can't remember the COS code) In it is a very good description of bubble sort, I used the explanation in that book and developed my algorithm from there, It worked first time. (But me and meansort...we no family).
cool smiley
Re: Assignment 03Q4
June 11, 2007 11:10AM
Sakkie - it was COS113, and thanks for the heads up. I'll have to dig up the old textbook.
Re: Assignment 03Q4
June 13, 2007 10:04PM
Bubble Sort, mmmm... that was fun. It's pretty straight forward, so i'm gonna post my way of doing it for those who can't snap it (not giving code cause that'll take the fun out of figuring it out and understanding it).

For those for you that are completely at a loss, think like this, it's called a bubble sort cause essentially the element bubble up into order.

what you need to keep in mind is that if your list has n unsorted elements then you'll need to pass thru your list n*n times (so 10 elements will give you 100 passes). I used 2 loop, the inner compares two adjacent elements and swapping as necessary. the outer loop just resets my index so that the inner can start from the end again and ensures that all the elements are check.

so, for a list of 10 elements you are gonna loop a "countdown" from the last to the first element and inside that loop the comparing and swapping the elements.

i reckon that for an extra fun try making it recursive...
Sorry, only registered users may post in this forum.

Click here to login