Interview Questions

  • View all interview questions
  • blank
  • Implement bubble sort
    Implementing bubble sort is used as an example of a slightly harder problem that one should solve to be prepared for the App Academy bootcamp. The source link is listed below, but the statement was:
    I often use "implement bubble sort" (in a beginner-friendly language like Ruby or Python) as an example of one of the harder problems I had to do in order to get in to App Academy.
    We'll go ahead and implement bubble sort in JavaScript and Python below. Bubble sort is actually a very slow algorithm that one should never attempt to seriously use, but the algorithm is simple enough to implement which is why this question might be asked.



    You need to be a premium member to see the rest of this question and code.

    Become a Premium Member

    With our large collection of challengs, tutorials, and solutions, we make it easy for you to become a better coder, prepare for interviews, and learn new skills from more experienced coders.

    “I would like to share that Coderbyte was the major contributor to my studies. I was accepted into Hack Reactor earlier this week, and I wouldn't have gotten this far without it.” ― John Iaconis
    • 200+ Coding Challenges
    • Mock Interview Questions
    • 500,000+ Code Solutions
    • Algorithm Tutorials
    • Interview Prep Courses
    mrdaniel published this on 11/24/15 | javascript, bootcamp, array, sorting, App Academy
  • +
  • 0
  • -
  • Solution via C#:
            static void BubbleSort(ref int[] array)
                for (int i = array.Length - 1; i > 0; i--)
                    for (int j = 0; j < i; j++)
                        if (array[j] > array[j + 1])
                            Swap(array, j, j + 1);
            public static void Main(string[] args)
                    int[] array = { 8, 7, 6, 5, 3, 5, 1, 0 };
                    BubbleSort(ref array);
                    string str = string.Join(",", array);
    Login to submit a comment