I need to create a program that takes in doubles and then calculates the greatest value and the smallest value out of the entire data list. I cant use a vector or an array as in some cases the program will be taking in millions of numbers fed to it from an external file and storing all the numbers and then calculating them would take far too long. My trouble is I can't find a way to calculate the smallest value without using an array of some kind. Any help is much appreciated. Thanks!
Use two doubles (one that stores the smallest so far and one that stores the biggest so far). Each time you look at the next double, compare it with the smallest and largest so far. Assign the new smallest/largest when applicable. You can initialize the smallest/largest to the first one in the list.
You could use a binary tree, and balance it as you build it. If you merely need to find the highest and the lowest once for each set, shacktars solution is the best case scenario (because no matter what, you need to look at each data once, do it while you take it in). For storing it, you could use a linked list.
If you have over a million unsorted numbers, there really is no special way of quickly finding the smallest or largest, you need to check each value. If you are finding the max and min, and discarding the list, do what Shacktar said, if you will continue to use the data, sort it. And this will take time. If you are able to roughly compute how much space it will take before hand, a vector or array would be suitable. Otherwise, a linked list.