View Single Post
Old 08-27-2005, 05:58 PM   #7 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
Quote:
Run and debug my code to seee what it does.
To make this clear, here is a small example:
Code:
const int numbers[] = {1, 2, 4, 3, 6, 5, 14};
There will be 6 odd pairs ({1,3};{3,1};{1,5}{5,1};{3,5};{5,3}) or 3! since theres 3 odd numbers in the vector.
(Oops was that too much of a hint...)
Anyway I think people get the idear, the task here is to make a way of looping through the array in O(N) time instead of the O(N^2) time which Valmonts solution does.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote