Which Of The Following Represents The Algorithm Of Counting #931
which of the following represents the algorithm of counting sort correctly?
This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Sorting - Counting Sort - Quiz No.2.
which of the following represents the algorithm of counting sort correctly?
function countingSort(array, k) is count ← new array of k zeros for i = 1 to length(array) do count[array[i]] ← count[array[i]] + 1 for i = 2 to k do count[i] ← count[i] + count[i +1] for i = length(array) downto 1 do output[count[array[i]]] ← array[i] count[array[i]] ← count[array[i]] - 1 return output
function countingSort(array, k) is count ← new array of k zeros for i = 1 to length(array) do count[array[i]] ← count[array[i]] + 1 for i = 2 to k do count[i] ← count[i] + count[i - 1] for i = length(array) downto 1 do output[count[array[i]]] ← array[i] count[array[i]] ← count[array[i]] - 1 return output
function countingSort(array, k) is count ← new array of k zeros for i = 1 to length(array) do count[array[i]] ← count[array[i]] + 1 for i = 1 to k do count[i] ← count[i] + count[i - 1] for i = length(array) downto 1 do output[count[array[i]]] ← array[i] count[array[i]] ← count[array[i]] - 1 return output
function countingSort(array, k) is count ← new array of k zeros for i = 1 to length(array) do count[array[i]] ← count[array[i]] + 1 for i = 2 to k do count[i] ← count[i] + count[i + 1] for i = length(array) downto 1 do output[count[array[i]]] ← array[i] count[array[i]] ← count[array[i]] - 1 return output
Similar question(s) are as followings:
Online Quizzes of gs122 Data Communication and Computer Network
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes