07. Heaps


Arrays are a way to store data contiguously. In strictky typed languages, such as C++, Java or C#, arrays have to have an allocated size when initialized; loosely typed languages like JavaScript or Python do not have static arrays.


Uses

  • apps where you queue to buy or wait for things (concert tickets, uber)
  • printers
  • memory management
  • applied on WhatsApp when we send messages to our friends and they don’t have an internet connection then these messages are queued on the server of WhatsApp.

Operations

Read / write [i] element = O(1)

Insert / remove at the end = O(1)

Insert in the middle = O(n)

Remove in the middle = O(n)


← Back to main blog