All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Algorithm requested (Posted on 2013-12-18) Difficulty: 3 of 5
Given an array with random odd and even integers.
Please suggest the most efficient algorithm to put all even numbers on one side and all odd numbers on the other side in this array.

Source: Got an Email from an unknown person.

  Submitted by Ady TZIDON    
Rating: 4.0000 (1 votes)
Solution: (Hide)
Larry's way(reworded): (1) convert each number to base 2,then reverse its digits. (2) sort all the numbers from smallest to largest. (3) reverse the digits in each number and convert each to base 10. The new array starts with all even numbers.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Some ThoughtsAnother AlgorithmBrian Smith2016-06-21 11:18:10
an algorithmLarry2013-12-18 15:38:33
Some Thoughtsa couple of algorithmsCharlie2013-12-18 13:09:55
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information