menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

What I Lea...
source image

Dev

3w

read

61

img
dot

Image Credit: Dev

What I Learned About Arrays While Grinding NeetCode 150

  • Arrays are basic data structures stored contiguously in memory, including static (fixed size, type) and dynamic arrays (with flexibility).
  • Key operations for static arrays: Reading (O(1)), Traversing (O(n)), Insertion/Deletion at End, and in the Middle (both O(n)).
  • Dynamic arrays (like in Python, JavaScript) grow dynamically by creating new arrays when reaching capacity.
  • Reading from an array (accessing by index) is O(1), while inserting at an arbitrary index is O(n).
  • Appending (end insertion) is O(1), while inserting at arbitrary index requires shifting (O(n)).
  • Deleting from the end is O(1), while deleting from an arbitrary index is O(n).
  • Array traversal methods include for and while loops, and matrix traversal involves nested loops.
  • Python list essentials like list comprehensions and slicing are explained with examples.
  • Common list methods (append, insert, pop, remove, sort, reverse) are outlined with their time complexities.
  • Interview tricks & patterns like Binary Search, List Copy vs. Reference, and Sliding Window Pattern are provided.

Read Full Article

like

3 Likes

For uninterrupted reading, download the app