Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Basic Sorting Algorithm

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Basic Sorting Algorithm. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Implement a basic algorithm for sorting data.

Implement bubble sort for an array of integers. Return a new array containing the values in ascending order. Do not use Python's built-in sorting functions.

Input: A list of integers.

Output: A sorted list of integers.

Constraints

  • 0 <= len(data) <= 500
  • -10^9 <= data[i] <= 10^9
  • Return a new list and do not use built-in sorting functions

Function Signature

def sort_data(data):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output