Solved

Sort

Posted on 2002-04-27
3
169 Views
Last Modified: 2010-05-02
Hi All,
I am using the QuickSort algorithm to sort an array with strings in it. There are 7500 records but soon there will be 180,000 records. I started running it last night and when I came into work this morning it was only 72% done. Is there a faster way to sort an array. Or maybe I am using QuickSort wrong. Right now I have a loop reading a text file and putting the data into an array. Every time it loops I call QuickSort. Do I need to do it this way or do I just call QuickSort once. Here is the code I am using:

        Do Until (EOF(2))
            Line Input #2, theLine
            dataArray(x) = theLine
            Call QuickSort(dataArray)
            x = x + 1
        Loop

Thank You,
Kent
0
Comment
Question by:kmurphy7
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
justinhemphill earned 200 total points
ID: 6973146
Just call QuickSort once outside the loop.
0
 

Author Comment

by:kmurphy7
ID: 6973148
So my code wuold look like this:
       Do Until (EOF(2))
           Line Input #2, theLine
           dataArray(x) = theLine
           x = x + 1
       Loop

       Call QuickSort(dataArray)
Is this correct?
Thank You,
Kent
0
 

Author Comment

by:kmurphy7
ID: 6973170
Thank You for your quick response.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now