Data Structures – Use of Data Structures in PD Material

Data structures organize the data used by a program to efficiently solve a problem. Different data structures exist to support the implementation of a broad variety of algorithms. The choice of a data structure depends on what type of problem is being solved and how the data is represented. It is important to note that a data structure is a programming construct. It is not necessarily a physical component of the computer, nor an organized information management tool such as a database.

The following examples covered in the PD material use strings or lists in Python:

Examples of Using Strings

Loops in Python:

Recursion – Algorithms:

  • Example 4: Reversing a string
    • This example illustrates how to use string indices and the len() function to write a recursive program reversing a string .

Examples of Using Lists

Algorithms – Solving Problems:

Recursion – Algorithms:

  • Example 3: Binary Search
    • This example illustrates how to search for an item in a sorted list and describes a solution based on recursive version of binary search.