Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2004, 06:31 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default Efficient Array Sorting Technique

What is considerd the most efficient method of sorting an array?

EG:
1..Re ordering the values from lowest to highest - or visa versa
2..Detecting duplicates
etc...

I dont believe there are specific VBscript functions and have found conflicting opinions in my research. Some even suggest flirting with javascript's .sort


Wind is your friend
Matt
__________________
Wind is your friend
Matt
 
Old June 5th, 2004, 08:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Matt,

You might want to take a look at this?

How can I quickly sort a VBScript array?

How can I sort a VB Script array in ways other than by case-sensitive alphanumeric order, like numeric value, length of string, or even randomly?

Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 6th, 2004, 12:28 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Vijay

Thank you for your time, a couple of good links.

Wind is your friend
Matt
 
Old June 8th, 2004, 06:31 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Looking for thoughts/opinions:

-------------quote-------------
You could simply write your own sort algorithm (like a bubble sort) and encapsulate it in a function, however there's another way that's faster, while remaining very flexible. The key is using the JScript array's highly efficient sort method
--------------finish quote-----
Ref:http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=83
------------------------------

My two cents worth:
I dont question the above information, wouldnt dare....
However, I find it a bit weird skipping between jScript and vbScript could be the most efficient method of array sorting. Does anybody have the time to explain how this could be?

My objective:
I have a project that requires an audit tool, I am convinced - extracting info from DB (very possible large amounts of data) populating array(s) then sorting is the most resource efficient method. While sorting I will be checking/refining existing arrrays, creating new arrays etc....

Summary:
This brings me back to my intial question (start of this post)
"What is considerd the most efficient method of sorting an array?"
Should I use this vbScript/jsScript method?
OR
Go with my usual multiple nested FOR loops?

Thank you in advance


Wind is your friend
Matt
 
Old June 8th, 2004, 10:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Matt,

Just widened my search on array sorting, seeing your concerns based on efficiency hit with skipping between JScript and VBScript. Found this URL that uses either VBScript or Javascript, whichever you feel that suits your requirement, you can stick to that.

Sorting Arrays: VBScript Implementation

Sorting Two Dimensional Arrays: VBScript Implementation

Randomly Reordering an Array - got three parts and live demo too.

PS: I actually had that in my favourites, didn't strike at the right time. Have used this in my system sometime back, and works fine.

Hope that answers you requirement.
Cheers!

_________________________
-Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Array in C++ code_lover C++ Programming 4 October 16th, 2008 01:43 AM
Most efficient overriding technique jcsdeveloper C# 4 December 7th, 2005 04:18 PM
error when sorting an Array of Array nancy VBScript 2 February 17th, 2005 12:57 PM
Efficient implementation of multidimensional array Utwig C# 2 October 26th, 2004 04:34 AM
Array Sorting Dinesh22 VB.NET 2002/2003 Basics 2 February 3rd, 2004 11:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.