28 Topics

Member Avatar for
Member Avatar for vegaseat

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 for David_50
5
728
Member Avatar for Anil2447

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

Member Avatar for Talha_5
0
9K
Member Avatar for chubbyy.putto

I am creating 30 random from last function and the last function have pass the information to this one. I am using the bubble sort because i want to make a mode. But mode is not idea here. Anyway, it run but it show some crazy output. Here is the …

Member Avatar for chubbyy.putto
0
257
Member Avatar for H_beginner

Can any one tell me what I am doing wrong. I am sorting a single linked list. void ll::sort() { for(int i=0;i<size-1;i++) {node *cptr = fptr; for(int j= 0;j<size-1;j++) { if((cptr->no) > (cptr->nxt->no)) { if(cptr == fptr) { node *c2ptr = cptr->nxt; cptr->nxt=c2ptr->nxt; c2ptr->nxt=cptr; fptr = c2ptr; } else { …

Member Avatar for richieking
0
307
Member Avatar for Waseemaburakia

I'm trying to modify a Bibblesort code I'm writing that will count the number of instances and print out a seperate line for each instance and how many occurances it had. def BubbleSortList(MyList): ComparisonCounter = 0 for j in range ( len(MyList)): for i in range ( len(MyList)-1-j ): if …

Member Avatar for Waseemaburakia
0
288
Member Avatar for aVar++

Hi guys, I got this from my teacher and im really confused. could anyone point me in the right direction? Thanks > What does it do? > > This time I'm looking for an overall summary, in one sentence, with the word "by" in the middle: > "This function ..........., …

Member Avatar for Lucaci Andrew
0
207
Member Avatar for dreamslct

Hi everybody, Just wondering if it is possible t hat we can change the text size in balloon or bubble message or whatever you call it the one we create useing "trayicon.displaymessage("message", "message", message.info);Highly appreciate if someone could help me out. Thanks.

Member Avatar for JamesCherrill
0
357
Member Avatar for flopoe

Hello everyone; I am new to Python. How can we explain this code step by step. I couldn't understand some parts. myList=[43,21,12,80,3,2,35] end=len(myList)-1 while (end!=-1): swapped=-1 for i in range(0,end): if myList[i]>myList[i+1]: temp=myList[i] myList[i]=myList[i+1] myList[i+1]=temp swapped=i end=swapped print(myList)

Member Avatar for vegaseat
1
981
Member Avatar for happygeek

According to the Sunday Telegraph [newspaper yesterday](http://www.telegraph.co.uk/technology/facebook/9276699/Facebook-IPO-fight-back-begins-share-price-implausible-says-analyst.html ) "Morgan Stanley, Facebook’s lead financial adviser, ended the day with 162m shares, worth $6.16bn. Other banks including JP Morgan and Goldman Sachs also bought shares, ending the day with $3.2bn and $2.4bn holdings respectively" which is kind of worrying when you step …

Member Avatar for TopCat23
0
1K
Member Avatar for edwarddaniel.baldeviano

Hi, everyone! This is my first post ever here in Daniweb. I experienced a problem in printing the sorted array of 5 numbers, as the following code only prints the first iteration of the loop, and it does not print the array input. Here's the code: section .data i db …

0
587
Member Avatar for vasvigupt

I trying to sort an array ising php but this code is not working. can any body tell me whats wrong with this code, is my logic is right or wrong. I don't know much about Php as I am new to learning php <? php $a= array(12,5,78,10,63,11); $size=$sizeof($a); for($i=0;$i<=$size;$i++) …

Member Avatar for Que336
0
270
Member Avatar for dariaveltman

hi everyone!!! I am trying to write a code for list of names to be sorted in alphabetical order. can anybody please tell me what I am doing wrong. and one more thing , is it possible to bubble sort a names in unspecified number of entries? and if it …

Member Avatar for Lerner
0
246
Member Avatar for dariaveltman

please tell what am I doing wrong. #include <iostream> using namespace std; int main() { char name[3][30]; int i, j; for(i=0;i<=2;i++) { cout << "Please enter name: "; cin >> name[i]; } for(i=0;i<=1;i++) { for(j=i+1;j<=2;j++) { char temp; if(name[i] > name[j]) { temp = name[i]; name[i] = name[j]; name[j] = …

Member Avatar for Sahil89
0
179
Member Avatar for needforkevin

hello! i have written a program to read in a text file and then ask the user to process the file with a different sorting method. so far i have been able to get my program to read in the file but my bubble sort seems to not be sorting …

Member Avatar for needforkevin
0
240
Member Avatar for cryonize

I was asked to create a program that enters numbers and displays the before sorting order, and the sorted order displaying the previous node address and the next node address. I was told not to swap the data inside the nodes, but move the nodes themselves. I have a problem …

Member Avatar for TrustyTony
0
9K
Member Avatar for kiail

I'm trying to make a bubble sort to sort numbers like 3.2, 5.8, etc(double / float numbers). I have this code so far, but I'm still trying to learn and don't know why my code isn't working the way I think it should. Any help is appreciated. [CODE]using System; using …

Member Avatar for Momerath
0
269
Member Avatar for jaymayne

Need help making a module that sorts 4 arrays this how it started out void dataSort (float sLengthArray[],float rSlopeArray[],float speedArray[], float size) { void swap (int *x,int *y); int pass,j; for (pass=0;pass < size-1; pass++) { for (a = 0;j< size-1; j++) { if (slengthArray[j] > slengthArray[j + 1]) { …

Member Avatar for zeroliken
0
255
Member Avatar for patyypol

need to make a function that sorts integers from smallest to largest without using the sort function in python python must open a file with integers one per line store the data in a list then print the unsorted list then bubble sort code sorts the list from smallest to …

Member Avatar for TrustyTony
0
120
Member Avatar for hish84

Hi All, Can we use CSS to make rounded corner or bubble speech text area using CSS? I already have my application generating code to show a rectangle, and I want it to look more appealing. Any suggestions are welcome

Member Avatar for AbhishekBiswal
0
282
Member Avatar for manongjulius

so. . . i guess you could say i'm kinda new here but. . . this site really helps me alot this past few days and i decided to join... i was surfing all over the internet and i can't find what's the problem with my program. this always says …

Member Avatar for manongjulius
0
281
Member Avatar for seanbp
Member Avatar for eviah

Hi guys, this is my first post here, and I'd love any feedback you guys can give me. I'm writing a basic program that bubble sorts its ints in an array to ascending order, then resorts some of those specific ints to the element of the position they represent. What …

Member Avatar for eviah
0
189
Member Avatar for nrue

How do I properly bubble sort through a text file by assigning the values to an array. In the code below I tried to assign the values from the text file to a string while there is still something to fetch. Then I used a for loop to assign the …

Member Avatar for NormR1
0
1K
Member Avatar for guru_iyer

I have been told to sort an array of structure(student) depending on one of its members(per) using bubble sort. I need to sort the 'student' structure in descending order of 'per'. Please help. I'm stuck!! [CODE] #include<stdio.h> #include<conio.h> struct student { char sname[20],dept[25]; int rollno; float per; }s[30]; void accept(int …

Member Avatar for guru_iyer
0
931
Member Avatar for addxztion

So uhm...I want to do the bubble sort and i found a code but actually i don't really know what's missing...ok...sorry but i am just a newbie and not so average of logic(lol. :p). My goal here is to complete this code, 'cause i tried to run it but it …

Member Avatar for addxztion
0
166
Member Avatar for P3druh77

Hi... i have a little problem on my code... HI open a txt that have this: LEI;7671;Maria Albertina da silva;xxxx@gmail.com; 9;8;12;9;12;11;6;15;7;11; LTCGM;6567;Artur Pereira Ribeiro;fdsdfsd@gmail.com; 6;13;14;12;11;16;14; LEI;7701;Ana Maria Carvalho;asasssas@gmail.com; 8;13;11;7;14;12;11;16;14; -------------------------------------------------------------------------------- LEI, LTCGM are the college; 7671, 6567, 7701 is student number; Maria, Artur e Ana are the students name; [email]xxxx@gmail.com[/email], …

Member Avatar for Aia
0
242
Member Avatar for pinknblu

It provides the average grade of an student. Assignment: How many students are in the class ? 3 Enter five test scores for student number 1 80 90 70 90 80 The average for student number 1 is 85 Enter five test scores for student number 2 100 60 60 …

Member Avatar for pinknblu
0
183
Member Avatar for rhoit

I was trying to Compare the 5 Sorting Algorithms using 4 test cases. [U]Sorting Algorithms[/U] [LIST=1] [*]Selection Sort [*]Insertion Sort [*]Bubble Sort [*]Quick Sort [*]Merge Sort [/LIST] [U]Test cases[/U] [LIST=1] [*][URL="http://the.nube.googlepages.com/Sort.Analysisplot1.svg"]Random Data [/URL](completed) [*]Reverse Sorted Data (completed) [*]Almost Sorted Data (can't generate Data) [*]Highly Repetitive Data (can't generate Data) [/LIST] …

Member Avatar for rhoit
1
861

The End.