Ubuntu Bubble Sort In C#

guys i am writing a program, well trying to, i am just learning to program. I am writing a console application that allows the user to input 10 numbers, and what i want is to sort them and use bubble sort.here is my code:using System;using System.Collections.Generic;using System.Linq;using System.Te ...

modified bubble sort function javascript help

this is an assignment, ive been on it all night.I have done the bubble sort function and have to modify it.I work out that if i could stop the amount of times it loops it would make it more efficient. To do this is would need to stop the loop when no swaps have been made on the full array.lenght-1. ...

Bubble Sort

OK, I know a bubble sort is very inefficient for sorting values but I have to do it as part of some coursework.I have the code working, i.e. it produces a sorted list of numeric values but the process of sorting the values is wrong.Below is my complete script.<HTML><HEAD><TITLE>A p ...

bubble sort

I am getting into simple algorithms. I am starting with the bubble sort which was suggested by a friend. He ended up giving me the code to look at. Here is the code and the questions I have:#include <iostream.h>int main() {int array[] = {22, 23, 21, 20};int n = 4;for ( int i = 0; i < n-1; i ...

Bubble Sort Issue

I am trying to implement a bubble sort algorithm in a linked list. The code runs to completion, but when I try to print it, I get the following error: Unhandled exception at 0x01222833 in LinkedList.exe: 0xC0000005: Access violation reading location 0xfeeefef6. I have included the relevant code belo ...

Bubble Sort Array

Hello, I need to sort this array in ascending order by ISBN number using a bubble sort. Can anyone help me? Thank you. var books = [];books[0] = "1565923928:Programming In javascript:2290:950";books[1] = "2010948473:Java The Definitive Guide:1499:700";books[2] = "1098767854: ...

C++ Bubble Sort/Binary Search Help

side note: admin, for some reason it posted it in html at first... so feel free to delete it if you want.So for my last assignment i have to create a program that allows the user to input 100 foods, enter calorie amount and then using bubble sort and binary search it has to be able to display them b ...

Bubble Sort and Binary Search check

I was required to insert a bubble sort and binary search into my program. Here is the code I added:# include <iostream># include <string>using namespace std;int main(){string menuitem[100];int counter=-1, calories[100];do{ counter++;//asking for information to put into the menuitem array ...

Help Bubble Sort problem

side note: admin, for some reason it posted it in html at first... so feel free to delete it if you want.So for my last assignment i have to create a program that allows the user to input 100 foods, enter calorie amount and then using bubble sort and binary search it has to be able to display them b ...

Modified Bubble Sort

ok, so i have to do this"after the first pass, the largest number is guaranteed to be in the highest-numbered element of the array; after the second pass, the two highest numbers are "in place," and son. Instead of making nine comparisons on every pass, modify the bubble sort to make ...

Double list sort (bubble sort) URGENT!!

Hov can I sort double linked list with bubble sort, i have it for may homework but I dont have any idea!!!Please help!! ...

C++ Bubble sort

I found the code for bubble sort in C++.With the code below the print screen will be:2387665221Is it possible that sorts the numbers so the print screen will show all changes. In example:9,6,5,23,2,6,2,7,1,89,6,23,5,2,6,2,7,1,8............23,9,8,7,6,6,5,2,2,1Thanking in advance#include <stdio.h ...

Bubble sort & File output jibrish errors???

This program is almost the same as the one last i posted but here the bubble sort algorithm is not working, i get a compiler error saying::size of cdRecords is not knownandneed explicit cast to convertI cant work out what the problem is because another program with exact same details but different s ...

Bubble Sort of a file of records in Pascal pls

i am trying to sort a file of records by name. Im trying to use the bubble sort but all the code i ve found is with the use of arrays. Any idea pls.Procedure Bubble_Sort;vara : array [1..20] of string;i,j : integer;t : string;beginclrscr;create_client;for i:= 1 to Filesize(C) doRead(C,recc);a[i]:= r ...

Bubble sort

I found the code for bubble sort in C++. With the code below the output will be:23 8 7 6 6 5 2 2 1Is it possible that sorts the numbers so the output will show all changes. In example:9,6,5,23,2,6,2,7,1,89,6,23,5,2,6,2,7,1,8............23,9,8,7,6,6,5,2,2,1Thanking in advance#include <stdio.h># ...

User Input and Bubble Sort

Newbie C++ programmer here I'm supposed to bubble sort an array to where I can eventually print it ascending and descending in the correct order. I am, however, having trouble passing the parameters for the bubbleSort and printElements functions.I get the error:error C2664: 'bubbleSort' : cannot con ...

Bubble Sort in Linked List- Help Greatly Appreciated

so, everything works through the first iteration (don't know if this is an appropriate term for linked lists, but we just learned arrays) but then it stops. I thought that telling it to continue until position.next != null and increasing the position after every iteration would work but I think I ha ...

ASM 2-D Bubble Sort!!

I'm required to do a 2-D bubble sort for an assignment in an asm course, but for whatever reason I cannot make it work. I can write one in 3 minutes in C++, but ASM just kicks my ass.In this instance I'm using a C++ file to make the function call, and just using my .asm file to declare the function. ...

bubble sort

this is the exact problem:Write a routine to sort the ten-number list shown in ‘Sample Screen Output’ below, and then make the following modifications to improve the performance of the bubble sort:Sample Screen OutputData items in original order2 6 4 8 10 12 89 68 45 37After pass 0: 2 4 6 8 10 1 ...

Bubble Sort a txt file

how can i bubble sort a txt file with some text in it? and then an output txt file should be created to show how much time the bubble sort took to finish the job... ...

Help with Sorting and displaying with bubble sort

I have an assignment in my Advanced C++ class using Visual C++. I have most of it but there is a problem. After each pass it is supposed to display the results. I can get it to display the unsorted list, display the sorted list but not after each pass. Can anyone help? Here is the code I have so far ...

Bubble sort a list container,without using sort() function

I need to bubble sort a list of integers(unknown size). Unfortunatly I cant use the sort() method. Have tried transfering the contents to an array and sorting that but to no avail.If Anybody feels like hitting mewith some ideas would be great. ...

multithreaded java bubble sort

i am doing an assignment and it is to create a multithreaded bubble sort but i am having problems initialising and assigning jobs to the threads. i have included the classes and the errors i am getting and was wondering if someone could tell me what is going wrong. CHEERSERRORSC:\Documents and Setti ...

C++ bubble sort to sort names

If you have an array of names. Does anyone know if it is possible to sort names in ascending using bubble sort in C++? ...

Grade book program using arrays and Bubble sort

I am writing a gradbook type program. It first allows the user to enter the number of students they want to enter. then allows them to enter the first name, last name, and grade of each student. The program then should sort the names alphabetically by last name and display a list of all the students ...

Bubble Sort Matrix Arrays

My homework requires me to write a program for a matrix that bubble sorts in descending order, then multiply by two and output results Tried doing these in different ways, maybe, someone out there can help..#include <iostream>#include <iomanip>#include < cmath>using namespace std;c ...

Bubble Sort

Can anyone explain how bubble sort work or give an example or a simple code that is bubble sorting Thanx in advance ...

Bubble Sort/Random Numbers

Once again I have found myself stuck on another problem in assembly langauge because it owns me. I am trying to write a program that uses the Bubble sort algorithm but to make things challenging I am required to use Local Variable. And that must be based off of this C++ coding:function BubbleSort(in ...

bubble sort

Can anyone help me in this code bubble sort in c++,,,this is my code....... void main(){int A[5]={7,2,10,15,3};int i,j,swap;for(j=0;j<5;j++){for(i=0;i<5;i++){if(A[i]>A[i+1]){swap=A[i];A[i]=A[i+1];A[i+1]=swap;}}}for(i=0;i<5;i++)cout<<A[i]<<endl;} ...

bubble sort help

does anybody know how to make bubble sort work in progressively smaller sizes and determine if a list is sorted on it's first try?i've got the basic bubble sort algorithm down. i just can't figure out the rest of it(my basic bubble sort code below)def bubbleSort(list1):for j in range(len(list1)-1):f ...

Simple Bubble sort C++ function

This code is an example of a simple bubble sort function in C++.the function doesnt receive or returns nothingjust for the record, some translations"declaracion de constante" = constant declaration"prototipo de funcion" = function prototype"arreglo" = array"Arreglo ...

Using Bubble sort to sort Arrays please help

I just learned about bubble sort and still don't know how to make it work in my program I hope someone can help me. This is my taskI should use parallel arrays (of size 20) for student name, student number, test score, and letter grade.The list must be sorted in alphabetical order by student name. I ...

Bubble Sort Issues

I'm having trouble inserting a bubble sort for my program, any help would be appreciated. #include <iostream>#include <string> using namespace std; int main() {string food[100]; string lookup; int calories[100]; int x = -1;do { x++; cout << "Enter a menu item (enter 'done' whe ...

descending bubble sort on an array

Hi. Well, I have finally been able to understand assigning data to an array using a sequential access file and a class. Now I am trying to sort the data in the array in "descending bubble sort" (we never learned this and my C++ Bible is not using the same code I am used to). I read this un ...

Sorting 2D Arrays With Recursive Bubble Sort

I am a Beginner, Please Help Me.If you Can Help me to find out how to sort a 2d arrays of characters with recursive bubble sort algorithm.I have got something but it doesn't work.what is my mistake?I Did codes below So far, but it isn't completed and has some errors. it is my primary Idea. check it ...

Bubble sort

I'm trying to write a program to read lists of number from a txt file then bubble sort it in increace order and find the average of every single list.That's what i got so farQuote ... #include <iostream>#include <fstream>#include <stdio.h>using namespace std;void bubbleSort(int *ar ...

writing loops for bubble sort

i am a bit confused on how to start this i have to write a for loop to read in 10 number , write bubble sort having 2 nested for loops and writing a loop to output to sorted array int main (){ int total_neg=0;// intialize int total_pos=0;int total=0;int num=0;int cnt=0;cnt=0;while ( cnt<10)//star ...

Bubble Sort Help

So for my last assignment i have to create a program that allows the user to input 100 foods, enter calorie amount and then using bubble sort and binary search it has to be able to display them back to the user. I have all of this done except the food does not match up with the calories.any help is ...

bubble sort

can anybody help me with this problemthe followig list is to be sorted using bubble sort65 48 33 97 42 55how many comparisons will be made?number of comparisons and the number of swaps are the same?is there a formula to calculate the number of swaps or comparisons?i know it starts with the 0th index ...

Bubble Sort (Number of Steps)

coders, newbie on board!Just a quick question: How do I calculate the number of steps a bubble sort takes to sort a database of n entries?On my notes it is written that "It is easy to see that a bubble sort of n records requires n−1 comparisons on the first pass, n−2 on the second and so o ...

Bubble sort structure array problem

guys, i programmed a bubble sort function in C and it doesnt seem to be sorting properly. Ive searched the forums and have seen similar posts and tried them but they dont work. Hoping someone could look over it to see if the concept/sytax is right.typedef struct{char artist[40];char title[60];int ra ...

PLEASE* Help me bubble sort this vector

I built this entire program and it does what I want it to except I want to use a bubble sort algorithm instead of the std::sort() function I have right now.So please help me out on this. I don't really understand how bubble sorts work even after reading up on it. Just a simple example of a bubble so ...

How To Bubble Sort

Can someone please explain the concept behind bubble sorting a vector step by step? I know this is a tedious task so whoever answers I will much appreciate it! Questions:1.) What variables are being used?2.) How and where is the function placed?3.) Where and why are the for loops?4.) Step by step pr ...

Bubble Sort Array/Dynamic Allocation

I have recently completed a bubble sort array program, which works fine. And is here :#include <iostream>#include <ctime>using namespace std;void bubbleSort(int Array[], const int arraySize){for(int j = 0 ; j < arraySize; j++){for(int number = j + 1; number < arraySize; number++){i ...

Bubble Sort in array ???

I'm trying to figure out how to use a bubble sort in a array of names. since the names are type string, I can't figure out how to alter the bubble sort to do this.all the examples I find online deal with numbers instead of strings.So how do I sort last names alphabetically using the bubble sort?Any ...

Bubble Sort after Selecting Search From Switch Statement

Hello. I am beginner using C++. I have been searching through previous posts, but I haven't found anything to apply to my problem...I have a program that I initialize data into an array. I am using a Structure. After initializing the data, I use a Switch statement to allow the user to select if they ...

bubble sort versions

here i have two bubble sort versions.void bsort(){int i,j,jc=0,ic=0,temp,swap=1;//for(i=0;i<NOE & swap;i++){ this one orfor(i=0;i<NOE-1 & swap;i++){ \\ this swap=0,ic++;for(j=0;j<NOE-1-i;j++){jc++;if(a[j]>a[j+1]){temp = a[j];a[j] = a[j+1];a[j+1] = temp;swap = 1;}}}printf("jc ...

Alphabetical bubble sort

I am having problems how to use bubble sort to sort names from an infile alphabetically, please help me for i have a test coming up soon and this is my main problem. ...

Bubble sort using recursion

This program sorts in descending order.Hey guys, I am wondering if I could get some help with making this bubble sort program sort recursively. Any help would be appreciated, thanks.#include <stdio.h>#include <conio.h>#include <iostream>#include <stdlib>#define TRUE 1#define ...

bubble sort for any user defined type funtion

i need a bubble sort algorithm in Java and make a class bubble_sortto sort any given array of any user defined type.can any of u give me a basic algoruthm i need to work with???? ...