Make an ordered array. Put a bunch of random numbers into
it.
Do 20 linear searches and 20 binary searches of that array.
(Code for linear search and binary search are found in the
book.)Print out how many elements were checked before the
item is found
I'm not looking for answers as it is homework. However I don't understand what I'm doing. This course is being held online(no other options) and that's not how I learn so I'm struggling. From my understanding I have to make a templated ordered array (which I don't understand at all) and then do searches (which I also don't understand). Any help would be appreciated
Ordered array is an array where all elemets are sorted.
If you do not need array which keeps itself ordered, I suggest to use std::vector<int>, put a bunch of random numbers in it and sort it using std::sort.