Description
1. Write a C program to implement Quick Sort Algorithm.
Home Assignment:
a. Given a binary array, sort it in linear time and constant space. Output should print all zeroes followed by all ones.
For example: Input: { 1, 0, 1, 0, 1, 0, 0, 1 } Output: { 0, 0, 0, 0, 1, 1, 1, 1 }
b. Given an array consisting of positive and negative integers, segregate them in linear time and constant space. The output should contain all positive numbers follow negative numbers. (Hint: Use concept of Quick sort).
For example: Input: [9, -3, 5, -2, -8, -6, 1, 3] Output: [-3, -2, -8, -6, 5, 9, 1, 3]
c. Given an array of integers, move all zeroes present in the array to the end. The solution should maintain the relative order of the items in the array. (Hint: Use concept of Quick sort)
(Format to submit the assignment)
CS3130 (Design and Analysis of Algorithm Lab)
Name:
Registration:
C Program Code:
Output:
Home Assignment Code Output
Reviews
There are no reviews yet.