Question: Suppose you are given an array, A, of n positive integers. Describe an O(n) algorithm for removing all the even numbers from A. That is,
Suppose you are given an array, A, of n positive integers. Describe an O(n) algorithm for removing all the even numbers from A. That is, if A has m odd numbers, then, after you are done, these odd numbers should occupy the first m cells of A in the same relative order they were in originally.
Step by Step Solution
3.34 Rating (163 Votes )
There are 3 Steps involved in it
For this problem we are going to use two variables count ... View full answer
Get step-by-step solutions from verified subject matter experts
