Interviewing for a staff swe position and the recruiter asked me what's the difference between a stack and a heap. I said a heap is like a laundry bag and a stack is what your dirty dishes look like. I got an email reject after this phone screen. F.
If you're wondering why, a heap is a tree structure. Can't imagine how it's like a laundry bag
OP tried to oversimplified it. It's not wrong but recruiter was looking for textbook definition
“A” stack and “a” heap, or “the stack” and “the heap”. The former refers to the data structures and the latter to the memory segments.
Play stupid games win stupid prizes
Nice answer
How would you answer lock vs semaphore?
Noice!
Why here? Stackoverflow
If someone didn't know the difference in an interview, they'd be in stack of trouble.
You malloc from the heap and you push and pop from the stack. Heap can get fragmented but can malloc and free out of order but you cannot push and pop stack out of order. What major?
Not everyone realises heap (as in memory heap) is not the same as a min/max heap. They were, perhaps, thinking of min/max heap, not the other heap
I always ask if they mean the abstract data types or memory