Question: JAVASCRIPT OR PYTHON Given: An array of size N, comprising the numbers zeroes, ones, and twos. Task: Create a function to Sort the array in

JAVASCRIPT OR PYTHON

Given: An array of size N, comprising the numbers zeroes, ones, and twos.

Task: Create a function to Sort the array in ascending order.

Input 1: [1,1,0,2,2,2,0,2,1,0,2,0]

Input 2: [2,1,0,2,1,0,2,1,0]

Expected Output 1: [0,0,0,0,1,1,1,2,2,2,2,2]

Expected Output 2: [0,0,0,1,1,1,2,2,2]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!