Professional Documents
Culture Documents
Data Structures AND Algorithms: Lecture Notes 9
Data Structures AND Algorithms: Lecture Notes 9
Data Structures AND Algorithms: Lecture Notes 9
DATA STRUCTURES
AND
ALGORITHMS
Lecture Notes 9
Queues
Spring 2008
template<typename Item_Type>
void queue<Item_Type>::pop() {
front_index = (front_index + 1) % capacity;
num_items--;
}
public:
Random() {
std::srand(std::time(0));
}
Random(int seed) {
std::srand(seed);
}
int next_int(int n) {
return int(next_double() * n);
}
double next_double() {
return double(std::rand()) / RAND_MAX;
}
};