## 20 Topics

 Topic Title ##vbScript - Sorting With and Without Code Please see my post [vbScript - The Basics](https://www.daniweb.com/programming/threads/516400/vbscript-the-basics) for more details on vbScript. Sorting is something that must be done from time to time. I'm going to examine three ways. The first is the well known (at least by name) QuickSort method. Rather … 1 1K Over the years I've seen a lot of discussion (and several implementations) of the Quicksort algorithm. Most of what I have seen, unfortunately, lacks sufficient commenting as well as meaningful variable names. Hopefully the following vbScript code will more clearly show how Quicksort actually works. A couple of incidental notes: … 1 2K Hello everyone,i think i know quick sort algorithm.But i need help in figuring out its worst case. Lets look at the below quicksort code----> void quicksort(int arr[],int low,int high) //low and high are pased from main() { int m; if(low p) r--; if (l <= r) { … 0 184 Quickselect, based on quicksort, and counting select, based on counting sort. Each is capable of finding the kth smallest element in an unsorted/sorted list/array. This is some example code for a QuickSelect algorithm. This doesn't include the partition function. // return the kth smallest item int quickSelect(int items[], int first, … 0 522 Having trouble getting the QuickSort to work in this code. I turned off the counter for now, just trying to get the sorted array to display correctly. This is the results I get from the code: This program keeps track of the number of comparisons required to to sort a … 0 233 I have a problem with this code : [CODE] #include using namespace std; void qsort(int A[], int len) { if(len>=2){ int l=0; int u=len-1; int pivot=A[rand()%len]; while(lpivot)u--; swap(A[l], A[u]); } qsort(A,l); qsort(&A[l+1],len-l-1); } else{return;} } void swap(int a, int b) { int temp; temp=a; a=b; b=temp; } … 0 214 Hi.... I wrote a program for Quick Sort algorithm.... It is compiled fine....but it is giving a run time error i.e., Segmentation Fault.... I tried hard but couldn't find out what is that thing causing segmentation error in this program.... Please help.... I'm getting segmentation fault very frequently (i'm using … 0 436 Hi, I'm getting segmentation fault errors when I use quicksort with ~350 000+ numbers. This is the quick sort algorithm I'm using: [CODE]void swap(int* v, int i, int j) { int tmp = v[i]; v[i] = v[j]; v[j] = tmp; } int partition(int *v, int s, int e) { int … 0 1K I've this quicksort code, and it compiles. The thing is, I don't know how to give random values (integers) to the vector. The program should ask for the vector's size and then create the x random integers so it can apply the quiksort method. [CODE]#include "stdafx.h" #include #include … 0 2K I keep getting a stackOverflow error in my quickSort and I can not figure out why. Any help would be greatly appreciated!! [CODE] private static void quickSortRecPriv(int[] arr, int first, int last, int ps) { int pivot = arr[first]; int left = first; int right = last; if (arr == … 0 194 CONVERT THIS QUICK SORT PROGRAM INTO PARTITION OF 3,5,7OR 11 ELEMENTS. [CODE] #include"stdafx.h" #include using namespace std; #include #include #define size 50 void swap(int *x,int *y) { int temp; temp = *x; *x = *y; *y = temp; } int partition(int i,int j ) { return((i+j) /2); } … 0 217 pls any one tell me why the loop is not ending?? (program for quick sort)[CODE][/CODE] [CODE]#include int partition(int a[],int l,int r); void quicksort(int a[],int low,int high); int loc,temp,pivot,a[50],low,high,left,right; int main() { int n,i; printf("\nEnter the no: of elements : " ); scanf("%d",&n); printf("\nEnter the numbers : "); for(i=0;i

The End.