Key Concepts in OOP and Data Structures

Core Object-Oriented Programming Concepts

  1. An object is an entity provided with a set of properties or attributes (data) and behavior or functionality (methods). It corresponds to real-world objects or internal system entities and reacts to events. It is an instance of a class.
  2. A method is a subroutine associated exclusively with a class or object. It defines a set of actions an object can perform. Methods represent the dynamic and functional part of an object and are commonly used to modify its properties, thereby changing its state, which can be perceived by the user.
  3. Properties (or attributes) are observable characteristics of an object. They describe an object’s appearance or state, often measurable to a predetermined level. Each property is assigned a value, and the combination of these values helps define the object’s state.
  4. Polymorphism refers to the ability for various classes, often derived from a common ancestor, to implement the same method in different ways.
  5. Inheritance is a mechanism where one class (the child or subclass) acquires the properties and methods of another class (the parent or superclass). The child class inherits properties and methods and recognizes its events, but can also have additional properties, methods, and events.
  6. Encapsulation is the property of objects where their internal state and implementation details are hidden from the outside world. This bundling of data with the methods that operate on that data ensures integrity and controlled access.
  7. A message is essentially a request sent to an object, instructing it to perform an action (invoke a method). It represents the communication between objects and typically includes the receiving object, the method to be invoked, and any necessary arguments (data). Upon receiving a message, the object executes the corresponding method.
  8. Objects are organized into classes. A class serves as a blueprint or template for creating objects (instances). It defines the common properties and methods shared by all objects belonging to that class.
  9. Instantiation is the process of creating an object (an instance) from a class. The created object possesses the attributes (properties) and methods defined by its class.

Common Tree Data Structures

  1. A tree is a widely used hierarchical data structure composed of nodes connected by edges, mimicking the shape of a tree.
  2. B-trees are self-balancing tree data structures commonly used in databases and file systems for efficient disk-based data retrieval. Unlike binary search trees, each node in a B-tree can have more than two children.
  3. A binary tree is a tree data structure where each node has at most two children, referred to as the left child and the right child. Nodes with one or two children are internal nodes. If a child reference is null, it indicates the absence of a child at that position.

Hashing Explained

  1. Hashing refers to the process of using a function (a hash function) to map data of arbitrary size to data of a fixed size (a hash value or hash). Hashes are used to generate keys that represent or identify data (like documents, records, files) in a concise, nearly unique way. A key property is that if two hash results are different, the original inputs must also be different. However, it’s possible for different inputs to produce the same hash (a collision).