yangshun / tech-interview-handbook

💯 Curated coding interview preparation materials for busy software engineers
https://www.techinterviewhandbook.org
MIT License
119.09k stars 14.73k forks source link

Queue cheatsheet for coding interviews may need to be updated. #602

Open ElliottLarsen opened 1 year ago

ElliottLarsen commented 1 year ago

Under Things to look out for during interviews it says the following:

"Most languages don't have a built-in Queue class which can be used, and candidates often use arrays (JavaScript) or lists (Python) as a queue. However, note that the enqueue operation in such a scenario will be O(n) because it requires shifting of all other elements by one..."

Shouldn't it say dequeue operation instead since removing elements from the beginning of a list() in Python, for example, will require other elements to be shifted down a step?