Interview Question for Software Engineer / Developers
- 0of 0 votes
Create a stack for bools. it will have these functions- email@example.com January 28, 2022 in United States
void push(bool input)
bool pop() // no one will ever try to pop if it is empty
bool empty() const // returns true if the stack is empty
void clear() // cleans out the data and recovers the memory
This stack should not be limited in size but grow as needed.
save space, it is ok if it is slow from time to time but should generally be fast
98% of the time we will push false and 2% of the time we will push true
the first push may be true or false
there may be long runs of just pushing true or long runs of just pushing true
how would you change it to if it was 80 / 20 and there were long runs of an average length of 15 trues in a row?
How would you change it if there were different ratios and different average length runs.
| Report Duplicate | Flag | PURGE
Software Engineer / Developer Data Structures
Interview Type: Phone Interview