56 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for chrisschristou

hello, i just set goal of mastering algorith and i just get started i have an algorhtm for insert sort and i when i write it in c it is not sorting this is the algorith for j D 2 to A_length key = A[j] // Insert A[j] into the …

Member Avatar for rproffitt
0
416
Member Avatar for rproffitt

http://imgur.com/gallery/dYgFh has a gallery of some visualizations of classic sorting. For your enjoyment. And with sound too! https://www.youtube.com/watch?v=kPRA0W1kECg This post is strictly for programming's secret pleasures.

2
240
Member Avatar for psvmr

I am trying to sort averages of scores in a class by pupil, from highest to lowest. My data is stored in text files like this: Charlie:0 Seema:2 Amber:4 Paige:5 Amber:8 Keith:1 Charlie:8 Seema:0 Charlie:9 Seema:3 Paige:0 Paige:4 Paige:4 Charlie:1 Keith:5 Keith:3 Here is my code so far: with open("class …

Member Avatar for vegaseat
0
962
Member Avatar for it@61@sec

I have the following struct definition: struct finfo { string filename; long fsize; bool operator() (finfo i, finfo j){return (i.fsize > j.fsize);} } fstruct; And the following vector definition: vector<finfo> fdata; In the code I use the following statement to sort the vector elements by fsize: sort(fdata.begin(),fdata.end(),fstruct); This works perfectly …

Member Avatar for it@61@sec
0
958
Member Avatar for rayhaneh

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" …

Member Avatar for rayhaneh
0
224
Member Avatar for mavtcr

Earlier I raised a question in this forum regarding the sorting of database and Reverend Jim answered me as follows. It was Ok SELECT * FROM mytable ORDER BY fieldname But then I faced another problem As I mentioned in that I wanted to sort ORDER by 'Tdate' which is …

Member Avatar for pritaeas
0
283
Member Avatar for mavtcr

Friends I met with a problem...Please help I have a table 'Tran' in Access Database which has several fields of which one is 'Date' I added several records through programm on different dates.Everything OK. All the records appeared in a chronological way ie.Earlier to Later order . Later I deleted …

Member Avatar for mavtcr
0
341
Member Avatar for seacase

I am trying to modify my shell sort algorithm to use Hibbard's increments rather than n/2. I know that Hibbard's increments are 2k - 1, but I can't figure out how to incorporate that into my algorithm. Any suggestions to help me move forward with this? I feel like I …

Member Avatar for Mohamed_22
0
4K
Member Avatar for dendenny01

My Program contains 4 arrays and I want to sort the array in such a way that if one array is sorted the other array should follow it Example: unsorted array name code salary date John 52 6500 15 Suzzy 10 1500 20 Mike 20 1451 16 Sorted array(according to …

Member Avatar for Adak
0
226
Member Avatar for HankReardon

Hello, What is the best way to check my code? I have written a program that counts the swaps required to sort an integer array using the Bubble, Selection, Insertion and Quick sort methods. How can I be absolutely certain that my swap counts are correct? Will someone take a …

Member Avatar for HankReardon
0
3K
Member Avatar for bymak87

I am supposed to create a file that will generate 100 random numbers and then sort them. I am stuck on the sorting. I think it would be a really simple solution but i cant seem to figure it out. I have tried the arrays utility and creating a method …

Member Avatar for nate.nelson.566
0
1K
Member Avatar for Begginnerdev

Hello my fellow Daniwebers! I am having some problems wrapping my head around the task sorting a List(Of CustomType) I have a list containing a custom class. The class contains Two DateTime objects, Start and End. I am trying to sort the list descending so that the shortest timespan will …

Member Avatar for Begginnerdev
0
442
Member Avatar for marnun

This is the exercise I have in codelab. I've been going over and over, and just can't see how to do it without an array. Must be something simple that I am missing. Any suggestions? _____ Assume you have a int variable n that has already been declared and initialized. …

Member Avatar for marnun
0
3K
Member Avatar for Atlanta15Braves

I am trying to sort a certain amount of integers. I have an error in my code. The code is below as well as my error message. Any suggestions of how to fix this? I believe it has to do with it being primitive data rather than an object? `public …

Member Avatar for subramanya.vl
0
367
Member Avatar for assgar

Hello I am trying to add two records to an array so I can identify which record has a priority 1 or priority 2. This is not working, how do get this to work? <? //get data from database $query = "SELECT a.street, a.city, a.province, b.dob, b.id1_name, b.id1_value, b.id1_priority, b.id2_name, …

Member Avatar for assgar
0
140
Member Avatar for waf4hmad

i made this code to loop number for(int i=0;i<4;i++){ double temp[i]=Math.random() * i*10; system.out.println("Result" +i+ "=>" +temp); } output : Result 0 => 14.3 Result 1 => 11.4 Result 2 => 10.8 Result 3 => 12.4 now, i want to sort by ascending this output based on value with keep …

Member Avatar for waf4hmad
0
2K
Member Avatar for PhilEaton

I need to order these dates in descending order (last should be first) and in fact how they now appear. However they do not necessarily appear like those so I need a SQL Order By clause to order these descending: 2012-01-23 09:53:24.097105 2012-01-20 17:31:57.565458 2012-01-20 17:01:09.154587 2012-01-20 16:28:40.685735 2012-01-16 12:03:54.99954 …

Member Avatar for JorgeM
0
441
Member Avatar for vishu.bhavsar

Hi All, Given an array of numbers, I want to find out the 2nd largest number in an array. Can anyone help me to solve the problem? Any help in terms of logic or code would be useful. Thanks, Vishal

Member Avatar for TrustyTony
0
141
Member Avatar for blackmagic01021

Hello, I have a observer pattern based JTable. With time it is poulated with new data packets. I use addRow functionalities to add my rows. But I want to put always the last coming datapackets at the top. How to do it??

0
127
Member Avatar for huphane

public class Exercise { /** * @param args the command line arguments */ public static void main(String[] args) { String A[] = { "Joseph","Ariana","Xena","Rene","Peter","Diana","Rihanna"}; String B[] = {"Madona","Diddy","Joe","Alice"}; for(int j = 0; j < A.length; j++) { for(int s = j +1; s < B.length; s++) for(int i = 0 …

Member Avatar for NormR1
0
281
Member Avatar for userct

I need to modify this movies program so that way the DVDs will be sorted by title at all times (A first thru Z). I need to use Binary Search so I put a method in DVDCollection but I'm probably missing something or calling it incorrectly. The program needs to …

Member Avatar for userct
0
234
Member Avatar for wallet123

i was watching a tutorial about bubblesort, and i followed all the instructions the difference is that the tutor is using System.out while im using JOPtionPane, please help me thank you help me find my error and help me run it correctly! [CODE]public static void main(String[] args) { // TODO …

Member Avatar for rushikesh jadha
0
181
Member Avatar for mani-hellboy

Hi friends., Actually I use datagrid to show my result from XML file.I load my data from XML file easily.But i need Sorting method for that and i don`t know how to solve it Please give me solution for that My code is [CODE] Imports System.Data Imports System.Xml Imports System.IO.StringReader …

Member Avatar for mani-hellboy
-1
122
Member Avatar for Kathyrine

I am trying to sort a record according to their respective number like this: [CODE] 5 reyes d r 1 2 3 3 delos d k 4 5 6 9 go t r 7 4 5 1 po w w 2 2 2 2 bun b m 3 3 3 …

Member Avatar for Kathyrine
0
5K
Member Avatar for minghags

Hello! I just made an program, but now i have problem with sorting output in the asc. order (int datum) thats date in our language :) [CODE] #include <iostream.h> #include <stdlib.h> struct datum { char dan [32]; char mesec [13]; char leto [5]; void vnosDatum(); void izpisDatum(); }; void datum::vnosDatum() …

0
114
Member Avatar for Griff0527

I would like to start this post off with, I am not looking for someone to do my homework for me. If I was looking for someone to "do it for me", I would go to one of the sites where you can pay someone to do your work for …

Member Avatar for Griff0527
0
1K
Member Avatar for Frankey

i am looking for some advice on what is the best approach to get this done :) my datababase holds a table categories with the columns [CODE]|category_id|category_name|category_parent_id|[/CODE] i am showing my users a html sortable table with the following columns |category_id|category_name|category_parent_name| so what i want, is to do a ORDERBY …

Member Avatar for Frankey
0
254
Member Avatar for RenanLazarotto

Yay guys, it's me again. I am using the code from here: [url]http://www.daniweb.com/software-development/vbnet/code/370426[/url] to sort my listview items. But I want something more 'dynamic': when I click on a header column, I want that it changes the sorting based on the column that has been clicked. here is my code: …

Member Avatar for codeorder
0
1K
Member Avatar for DarkPyros

hey, i'm supposed to prompt a user to enter 6 sets of numbers, find the difference of each set based on which number is greater(so that no negative number will be seen, enter the difference into the array, rearrange the array in ascending order and then print the array. the …

Member Avatar for DarkPyros
0
177
Member Avatar for gomonkeyninja

Hi, I'm a beginner with Java and I need help with an assignment: Write a program that will help the Toronto Blue Jay's scouts decide which players they should draft next year. For each player the scouts have been watching, a record has been prepared showing the player's name, age, …

Member Avatar for bibiki
0
366

The End.