##vbScript - A Multi-column Sort With Minimal Coding Please see my post [vbScript - The Basics](https://www.daniweb.com/programming/threads/516400/vbscript-the-basics) for more details on vbScript. A previous post dealt with sorting. The code easily handles sorting simple things like lists of words, lines of text - cases where you only had to compare two things. What about the case where you want the option to sort on an arbitrary column of data, or you want to sort on multiple columns such as by birthdate, then by last name. That becomes more difficult to code. Databases handle that with ease by allowing you to specify …

Member Avatar
+0 forum 0

Hi, i want to sort divs alphabetically both asc and desc. I am using a dropdown list created by using bootstrap: <div class="btn-group"> <a href="#" data-target="dropdown-menu" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown"> Sort By <span class="caret"></span> </a> <ul class="dropdown-menu" style="width: 100%;"> <li><a href="#" class="nameAsc">Name: A to Z</a></li> <li><a href="#" class="nameDes">Name: Z to A</a></li> <li><a href="#" class="priceAsc">Price: Low to High</a></li> <li><a href="#" class="priceDes">Price: High to Low</a></li> </ul> </div> and my divs i want to sort are populated with data from database: <div class="gallery_product col-lg-4 col-md-4 col-sm-4 col-xs-6 filter"> <a href="products_details.php?pid=<?php echo $row['fld_product_id']; ?>" class="btn btn-warning btn-xs" role="button"><img src="products/<?php echo $row['fld_product_img'] ?>" class="img-responsive"></a> …

Member Avatar
Member Avatar
+0 forum 1

Hie,I have Merge Sort Program .It's giving correct output but when checked through debugger it gives different values everytime.I also tried doing it manually but I am not getting the actual output. I will not ask now for complete program explanation. I just want to know the value over here.This is the half program. #include<stdio.h> int main() { int i,low,high,n,a[10]; printf("how many elements"); scanf("%d",&n); printf("\nEnter the elements"); for(i=0;i<n;i++) scanf("%d",&a[i]); low=0; high=n-1; msort(a,low,high); printf("The sorted array is "); for(i=0;i<n;i++) printf("\n%d",a[i]); return 0; } msort(int a[],int low,int high) { int mid; if(low<high) { mid=(low+high)/2; msort(a,low,mid); // values are correct here msort(a,mid+1,high); // …

Member Avatar
Member Avatar
+0 forum 1

// Also attached to this question is the assignment sheet. Need help pls. import java.util.*; import java.awt.*; import java.applet.*; public class Lab15st extends Applet { private int numBars; // number of bars to be sorted private int barHeight[]; // array of bar heights private int sortDelay; // delay between comparison iteration public void init() { numBars = 47; sortDelay = 20; // Change to 50 is using the "Selection Sort". barHeight = new int[numBars]; getBarValues(); } public void getBarValues() { Random rand = new Random(3333); for (int k = 0; k < numBars; k++) barHeight[k] = rand.nextInt(591) + 10; // …

Member Avatar
Member Avatar
+0 forum 2

How to implement bucket sort in C using Linkedlist.. Or any weblinks please share...

Member Avatar
Member Avatar
+0 forum 1

i should to move the biggest value to the last index in the array then to print the array. when i print it i get things like letters, smiles... what is the wrong in the code? .model small .stack 100h .data array db 3,8,5,3 n equ 4 b db dup 6 ('$') .code mov ax,@data mov ds,ax mov cl,0 mov si ,offset array mov di ,offset b mov ax,[si] myloop: cmp cl,n-1 je theend cmp ax,[si+1] jb next cmp ax,[si+1] jae continue next: mov di ,ax add di ,48 jmp my continue: mov di,[si+1] add di,48 jmp my my: inc …

Member Avatar
Member Avatar
+0 forum 1

I have to store the scores of people in a text file as an array, and I should be able to add each record on the array. This is the part of the code where the scores are being stored: if group == "a": with open("class scores A.csv", "a+") as f: f.write("{}:{}".format(name,score)) elif group == "b": with open("class scores B.csv", "a+") as f: f.write("{}:{}".format(name,score)) elif group == "c": with open("class scores C.csv", "a+") as f: f.write("{}:{}".format(name,score)) else: print("please enter a proper group") However, when I add a new score, it gets added on the same line, and if the name …

Member Avatar
+0 forum 0

I need to sort some information from an array. I'm trying to find the minimum value out of two numbers, from a csv file, the first part of the information in the file is the names of people, so instead of 0, I put 1 in int(row[1]) import csv print("1 for Group A\n2 for Group B\n3 for Group C") choice = (input) Group_A = open("class scores A.csv") Group_B = open("class scores B.csv") Group_C = open("class scores C.csv") if choice == 1: print("1 for students' highest score in alphabetical order\n2 for highest score to lowest score\n3 for average score highest to …

Member Avatar
Member Avatar
+0 forum 2

Let assume that ‘k’ is an integer that indicate and reveals exactly the length of subset that sum to 0. Thus length of subset to pick is determined by ‘k’. If I would like to pick only ‘k’ distinct set of integers from any given set of integers in polynomial time without having needed to check through every possible length other than the chosen length. What will be the time complexity and the size of the following examples? Given a set of integers {-3, 17, 30, 12, -8 -15, 7, 45, 16, 9} is there a non-empty subset whose sum …

Member Avatar
Member Avatar
+0 forum 1

Hi, I hope you can help me out of this because i really dont understand how to fix this code anymore, i tried and tried and it don't work. When i debug this code in Microsoft Visual Express 2010, it says the following erros are: 1>------ Build started: Project: Adreesbook2, Configuration: Debug Win32 ------ 1> adressbook2.cpp 1>c:\users\twice\documents\visual studio 2010\projects\adreesbook2\adreesbook2\adressbook2.cpp(37): error C2297: '>>' : illegal, right operand has type 'Node *' 1>c:\users\twice\documents\visual studio 2010\projects\adreesbook2\adreesbook2\adressbook2.cpp(37): error C2446: '==' : no conversion from 'int' to 'Node *' 1>Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast 1>c:\users\twice\documents\visual studio …

Member Avatar
Member Avatar
+0 forum 3

Part 2 of exploring/tasting the Swift language takes a look at dictionaries; process flow controls like loops, if/else and switch/case; functions and sorting. I hope I can follow this up with part 3, a closer look at class operations.

Member Avatar
Member Avatar
+2 forum 23

The bubble sort is slow and I thought it would be interesting to visualize the progress as it sorts an array of integers.

Member Avatar
Member Avatar
+5 forum 11

A little experiment with custom sorting the result of a word frequency count using Google's Go language.

Member Avatar
Member Avatar
+2 forum 2

I have DatagridView on form. My database has three fields. - userId (bigint) - userName (varchar) - userDob (date) Now, on Form I have comboBox, which lists Months (Jan, Feb, March and so on...). I want my program to work like this. If I select any month on ComboBox, birthdays of clients related to that month should only be displayed in DatagridView. Help me how to do it.

Member Avatar
Member Avatar
+0 forum 2

This is supposed to used quick sort using the header "arrayListType.h using quick sort and get the numbers entered smallest to largest but I'm not sure on how to do it. Can I please get some help? #include <iostream> #include "arrayListType.h" #include <cstdlib> using namespace std; void printList(arrayListType<int>& list); void quickSort(arrayListType<int>& list); // int main() { arrayListType<int> intList; // int num; cout << "Sorting Algorithms\n\n"; cout << ""; cout << "Enter numbers (-999 to stop: " << endl; cin >> num; while (num != -999) { intList.insert(num); cin >> num; } cout << "\nThe numbers you entered are: " << …

Member Avatar
Member Avatar
+0 forum 5

Use Google's modern Go language (aka. golang) to convert a denary number (base 10) to a roman numeral. Just a good exercise to explore Go's map, slice, sort and for loop features. Note that in Go the **:=** is shorthand for assigning a type (by inference) and a value to a variable. A slice is like an array that can grow, and a map is a key indexed list. Go has only the for loop, but the syntax is very flexible and can accomplish all the usual loop duties.

Member Avatar
+2 forum 0

Here is the code for [B][COLOR="Red"]Insertion Sort, Bubble Sort and Selection Sort[/COLOR][/B] [B]Insertion Sort[/B] [CODE] #include <stdio.h> main() { int i,j,key; int a[5]={5,2,3,4,1}; for(i=1;i<5;i++) { key=a[i]; while(i>0 && a[i-1]>key) { j=a[i]; a[i]=a[i-1]; a[i-1]=j; --i; } } int k; for(k=0;k<5;k++) {printf("%d ", a[k]);} printf("\n"); } [/CODE] [B]Bubble Sort[/B] [CODE] #include <stdio.h> main() { int i,j,x; int a[5]={5,2,3,4,1}; for(i=0;i<5;i++) { for(j=i+1;j<5;j++) { if(a[i]>a[j]) { x=a[i]; a[i]=a[j]; a[j]=x; } } } int k; for(k=0;k<5;k++) {printf("%d ",a[k]);} printf("\n"); }[/CODE] [B]Selection Sort[/B] [CODE] #include <stdio.h> main() { int i,j,x,min,k; int a[5]={5,3,2,4,1}; for(i=0;i<5;i++) { min=i; for(j=i+1;j<5;j++) { if(a[min]>a[j]) { min=j; } x=a[min]; a[min]=a[j]; a[j]=x; } } …

Member Avatar
Member Avatar
+0 forum 18

I have been trying to create a program which the teacher log in to view the scores of a test of a school class. The scores are stored in a text file like this: Charlotte:7 Charlotte:4 Charlotte:3 Chelsea:2 Chelsea:9 Chelsea:5 Jeff:1 Jeff:10 As you can see there are multiple scores for each student, I need to be able to sort these scores by highest score out of the class with each student's highest score. I've worked out how to sort it by each student's highest score with the following code but I now need to sort those highest scores of …

Member Avatar
Member Avatar
+0 forum 5

Hello, for a school assignment I was supposed to write an insertion sort algorithm for a doubly linked list. As the feedback system of this particular course is rather weak (actually non-existent) I would like to ask you for your honest opinion about how well this is implemented, what could be improved, made more efficient, etc? Thanks in advance, Marcel #include <iostream> using namespace std; class elem{ public: int value; elem* prev; elem* next; elem(int e, elem* ptr1, elem* ptr2){ value = e; prev = ptr1; next = ptr2; }; }; class list{ private: elem* first; elem* last; int length; …

Member Avatar
Member Avatar
+0 forum 4

I'm new at C++ ..and I dont know what should I do whith my program ... this program's input for exg. is: 5 mary sara kimi lili olive : : and then sorting them .. but my problem is that when I submit my home work they score me "0" and Icant find out why..! #include <iostream> #include <string.h> #define MAXNAMES 100 using namespace std; int compare(string s1, string s2){ int i; for ( i = 0; s1[i] && s2[i]; ++i) { /* If characters are same or inverting the 6th bit makes them same */ if (s1[i] == s2[i] …

Member Avatar
Member Avatar
+0 forum 2

Dear all, I need the code for counting sort algorithm but I try this code but is not working #include <iostream> #include <conio.h> #include <time.h> #include <stdlib.h> //srand and rand functions using namespace std; void add_random_numbers(long arr[], long b); void countingSort( long left, long right, long vector[], int k, long length); long const MADH_MAX_VEKTORIT = 110000; int main() { long random_vector[MADH_MAX_VEKTORIT]; long vector[] = { 1000, 10000, 15000, 25000, 30000, 45000, 50000, 60000, 75000, 90000, 100000 }; long num_elem; clock_t tn, tp; srand(time(NULL)); cout << "AlgorithmttNumbers_of_emelmentstttTime(s)n"; cout << "--------tt-------------------tt-------n"; for (long i = 0; i < 11; i++) { num_elem …

Member Avatar
Member Avatar
+0 forum 1

I want to make this code with random numebr array and time executation? Does anybady nows how can I do? #include <iostream> using namespace std; void print(int a[], int sz) { for (int i = 0; i < sz; i++ ) cout << a[i] << " "; cout << endl; } void CountingSort(int arr[], int sz) { int i, j, k; int idx = 0; int min, max; min = max = arr[0]; for(i = 1; i < sz; i++) { min = (arr[i] < min) ? arr[i] : min; max = (arr[i] > max) ? arr[i] : max; } …

Member Avatar
Member Avatar
+0 forum 1

I want to do one example of Radix sort generating random numbers and timing. Can anybady help me? Here is the radix pseudocode function radixSort(String s) for i in (s.length - 1) -> 0 do stableSort(s[i])

Member Avatar
+0 forum 0

Hello All, I want to write a c++ code to sort a queue with the help of another queue and a non array element. Please help me getting the code.

Member Avatar
Member Avatar
+0 forum 3

Hey Guys, Was wondering if anyone could help me with this sort function for a vector of struct type. What i'm aiming to do is to make a score board being based on a player's score and print out the scores (along with the name) in descending order. I've looked around the net and i believe i could use a comparison function similar to... bool sortbyScore(const PlayerScore &ps1, const PlayerScore &ps2) { return ps1.score > ps2.score; } and call it right before i print the vector. struct PlayerScore { string name; int score; } noah, bam; vector<PlayerScore> scores; void Game::setup() …

Member Avatar
Member Avatar
+1 forum 8

Hi, I have a 3-column data (below) from excel file. How can I write a perl code to sort all rows according to the first numeric number of a numeric interval and the word "complement" if they appear before the numeric interval as shown in the expeceted output below? Data: 81228..81500 Gene 22 81500..81856 Gene 17 complement(82256..84292) Gene 75 84307..85275 Gene 23 2.7.4.8 complement(97435..98067) Gene 91 complement(85325..86527) Gene 34 3.5.1.32 86756..87025 Gene 36 complement(92373..93341) Gene 45 88076..90292 Gene 34 complement(90289..92415) Gene 89 3.6.1.- 93492..94931 Gene 92 2.2.1.1 complement(97087..97347) Gene 12 2.7.7.6 complement(94928..97060) Gene 58 2.5.6.3, 3.1.8.2 79951..81162 Gene 3 1.7.1.2 …

Member Avatar
Member Avatar
+0 forum 3

I'm supposed to create a program to sort a names.dat file. It compiles but nothing is displayed. names.dat Collins, Bill Smith, Bart Michalski, Mel Griffin, Jim Sanchez, Manny Rubin, Sarah Taylor, Tyrone Johnson, Jill Adams, Andrew Moreno, Juan Wolfe, Bill Whitman, Jean Moretti, Bella Wu, Jeff Patel, Renee Harrison, Rose Smith, Cathy Conroy, Patrick Kelly, Sean Holland, Beth #include<iostream> #include<fstream> #include<cctype> using namespace std; void read_names(string names[],ifstream& infile,int& index); void selection_sort(string names[],int size); void print_names(string names[],int size); int main() { ifstream infile("names.dat"); if(!infile) { cout <<"" << endl; } int index = 0; string array[100]; read_names(array, infile, index); selection_sort(array,index); print_names(array,index); …

Member Avatar
Member Avatar
+0 forum 6

I am trying to get my head around the functions etc in xslt with xml. I have made a dummy xml file <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="books.xslt"?> <books> <book> <title>Hello Dolly</title> <author>John Thumb</author> <readers> <young_readers>17</young_readers> <older_readers>23</older_readers> <total_readers>40</total_readers> </readers> </book> <book> <title>Goodbye John Thumb</title> <author>Dolly Smith</author> <readers> <young_readers>12</young_readers> <older_readers>3</older_readers> <total_readers>15</total_readers> </readers> </book> <book> <title>A Boat Afloat</title> <author>Mike Sailor</author> <readers> <young_readers>19</young_readers> <older_readers>22</older_readers> <total_readers>41</total_readers> </readers> </book> <book> <title>Five Drummers Drumming</title> <author>Carol Christmas</author> <readers> <young_readers>11</young_readers> <older_readers>2</older_readers> <total_readers>13</total_readers> </readers> </book> </books> and what I wish to do is manipulate the reader's data to get different output. For example, sort all the young readers, find …

Member Avatar
Member Avatar
+0 forum 2

#include <cstdlib> #include <ctime> #include <iostream> using namespace std; int findSmallestRemainingElement (int array[], int size, int index); void swap (int array[], int first_index, int second_index); void sort (int array[], int size) { for ( int i = 0; i < size; i++ ) { int index = findSmallestRemainingElement( array, size, i ); swap( array, i, index ); } } int findSmallestRemainingElement (int array[], int size, int index) { int index_of_smallest_value = index; for (int i = index + 1; i < size; i++) { if ( array[ i ] < array[ index_of_smallest_value ] ) { index_of_smallest_value = i; } } …

Member Avatar
Member Avatar
+0 forum 1

Is there a way to sort a vector with a class that has an int variable? I want to have my vector sorted and printed in console. I want to be able to sort the vectors. Say i create a bunch of vectors here on user input `vector<PCB> Disks2[DiskDevices];` Basically if i choose `vector<PCB> Disks2[1];` itll sort 1 if i choose `vector<PCB> Disks2[2];` itll sort 2 based on the Cylinder in the class. And i have this class class PCB { public: void setPID (int a) { PID = a; } int retrievePID() { return PID; } void setFilename (string …

Member Avatar
Member Avatar
+0 forum 3

The End.