number randomization with bisection
Jan 7, 2010 at 8:29pm UTC
Anybody can help me? this is very imporant to me. I can do randomization from 0 to 80 as the task is saying but i don't know how to put bisection in this. As the task say bisection should find the randomized number and show in how many steps he find this number. Please if somebody know help me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
#include <ctime>
using namespace std;
int main(){
int tablica[1];
srand(time(0));
for (int i=0;i<1;i++){
tablica[i]=rand()%81;
cout<< tablica[i]<<" " ;
}
cout<<endl;
system("PAUSE" );
return 0;
}
im using dev c++
Jan 7, 2010 at 9:18pm UTC
Your table (tablica ) is only one element long... What exactly do you want to do the table with the bisection algorithm ?
Jan 7, 2010 at 9:39pm UTC
yes and i need it fast :(
Jan 8, 2010 at 5:15am UTC
It is hard to help because you are not making any sense.
It is like saying to someone:
Want to hear the end of a good joke?
"Because he wanted to."
Jan 8, 2010 at 5:34am UTC
Duoas is right!
I suggest to make your own algorithm first. Use your brainpower.
second search similar exercises related to your post. There were many of them I think.
Topic archived. No new replies allowed.