शब्दकोश · प्रोग्रामिंग

Data Structure

A data structure is a way of organizing and storing data in memory, such as an array, hash map, stack or tree, so it can be used efficiently.

अपडेट: अक्टूबर 6, 2026

A data structure is a particular way of organizing data so that certain operations, like lookup, insertion or ordering, are efficient. Common ones are arrays, linked lists, stacks, queues, hash maps, trees and graphs.

Why it matters

The right structure can turn a slow program into a fast one. Looking up a key in a hash map is typically constant time on average, while scanning a list takes time proportional to its length. Each structure trades speed, memory and flexibility differently, and an algorithm is usually chosen together with the structure it works on.

Example

StructureGood atWeak at
ArrayAccess by indexInserting in the middle
Hash mapLookup by keyKeeping sorted order
StackLast in, first outRandom access
QueueFirst in, first outRandom access
seen = set()          # hash-based: fast membership test
if user_id in seen: ...

Common mistakes

  • Using a list to check membership repeatedly when a set or dictionary would do.
  • Forgetting that mutable structures shared between functions can be changed unexpectedly.
  • Picking an exotic structure when an array or map is enough.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.