Skip to content

DK-So/BubbleSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Bubble Sorting Algorithm

This project demonstrates a simple implementation of the bubble sort algorithm in C++ using the Xcode IDE. It sorts an array of integers and prints both the unsorted and sorted versions of the array.

Project Overview

  • The main C++ file, main.cpp, contains a vector of integers and implements a bubble sort algorithm to sort the elements in ascending order.
  • The code first displays the unsorted array, performs the sorting, and then outputs the sorted array.

Key Features:

  • Bubble Sort Algorithm: A basic sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
  • Vector Operations: Uses the C++ STL vector for dynamic array handling.

How to Build and Run

Requirements:

  • Xcode: This project was created using Xcode, Apple's IDE for macOS. Ensure you have Xcode installed on your machine.
  • C++ Compiler: Xcode includes the necessary C++ compiler.

Steps:

  1. Clone or download the project.
  2. Open the Bubblesort.xcodeproj file in Xcode.
  3. Build the project by selecting Product > Build in the Xcode menu or by pressing Cmd+B.
  4. Run the project by selecting Product > Run or pressing Cmd+R.

Expected Output:

The program will print the following to the console:

  • The original (unsorted) array.
  • The sorted array after the bubble sort is applied.

Example:

Original array: 2 5 3 6 9 8 5 
Sorted array: 2 3 5 5 6 8 9 

License

This project is open-source and can be freely modified or distributed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages