Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 26th, 2004, 02:27 AM
et_me's Avatar
et_me et_me is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Malaysia
Posts: 160 et_me User rank is Corporal (100 - 500 Reputation Level)et_me User rank is Corporal (100 - 500 Reputation Level)et_me User rank is Corporal (100 - 500 Reputation Level)et_me User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 6 h 20 m 9 sec
Reputation Power: 8
Send a message via Yahoo to et_me
Comb Sort Algorithm Enquiry

I have a problem here. The question is like this:

Write a comb sort function.Comb sort is a modified bubble sort routine that has a reducing variable comparison gap. A standard bubble sort has a comparison gap of 1 ie comparing with the nest elements that makes it very slow. The comb sort has a comparison gap that starts with the length of the list divided by 1.3 and reducing by a factor of 1.3 for every pass until it reaches 1.

My algorithm is like below:
Quote:
VAR list_length,pass,compared_position,compared_var,first_var

list_length= GET List length
pass=list_length / 1.3
WHILE pass < 1
compared_position=round(pass)
GET compared_var at compared_position
GET first_var in the list
IF compared_var <= first_var
PUT compared_var ahead first_var
END IF
pass=pass/1.3
LOOP

I don't know whether my logic is correct or not. Any comment , suggestion and correction are very much appreciated. Thankz in advance.
__________________
If you can dream it, you can create it; it you can believe it, you can become it. --Anon

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Comb Sort Algorithm Enquiry


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT