Data Structures and Data Structures and Algorithms

Data Structures and Algorithms

Definitions

  • Data: Collection of raw facts (images, numbers, letters, symbols).

  • Data Structure: Representation of the logical relationship between data elements; a specialized format for organizing and storing data in memory.

  • Algorithm: A set of computer rules and procedures to solve a problem.

Relationship

  • Program = Algorithm + Data Structure

Classification of Data Structures

  • Primitive Data Structures: Directly operated upon by machine instructions (e.g., Integer, Float, Character, Pointers).

    • Common operations: Create, Selection, Updating, Destroy/Delete.

  • Non-Primitive Data Structures: Derived from primitive data structures.

    • Emphasize structuring groups of homogeneous or heterogeneous data items.

    • Linear Data Structures: Elements are in a sequence (e.g., Stack, Queue, Linked Lists).

    • Non-Linear Data Structures: Data items connect to several other data items, exhibiting hierarchical relationships (e.g., Trees, Graphs).

    • Common operations: Traversal, Insertion, Selection, Searching, Sorting, Merging, Destroy/Delete.

Difference Between Primitive and Non-Primitive Data Structures

  • Primitive data structures are basic structures built into the language (Integer, Float, Character, Boolean).

  • Non-primitive data structures are built from primitive data structures (Linked-list, Binary search tree, AVLTree, Graph).