Analyzing Algorithm Complexities: Binary, Linear, Merge Sort & Recurrences

Algorithm Complexity Analysis

1. Best-Case, Average-Case, and Worst-Case Complexities of Binary Search

Binary search operates on a sorted array. It repeatedly halves the search interval, comparing the target value with the middle element. If the target matches the middle element, its index is returned. Otherwise, the search continues in the left or right half.

Best-case Complexity:

Definition: The minimum time the algorithm takes.

Binary Search Best-case: If the target element is the middle element on

Read More

C Programming: Arrays, Strings, Structures, Pointers

Numeric Arrays or Vectors

Consider a vector as a sequential formation in memory. All data elements of an array must be of the same data type and the same type of storage.

Declaration

To declare a one-dimensional array, specify the size of the array with a positive integer expression enclosed in square brackets.

Syntax: type-of-storage data-type array_name [expression].

Reference Array Elements

To reference an array element we will use an index. The index value must be a positive integer, it can be an

Read More

Memory Hierarchy and Main Memory Types in Computers

PART 1: Hierarchy of Memory – (T.1) Basics

LOCATION:

  • a) Internal memory: Main memory, CPU registers, memory control unit CPU (microprogrammed control)
  • b) External memory: Storage devices and peripherals such as disk and tape

CAPACITY:

Is expressed in bytes or words for internal memory and is usually expressed in bytes for external memory.

UNIT TRANSFER:

  • Number of lines of input/output of the memory module (for internal memory)
  • Related Concepts:
    • Word: “Natural” unit of the organization of memory; its size
Read More

Python Programming: Functions, Packages, and OOP Concepts

Python Functions

1. Definition: Functions are defined using the def keyword.

2. Parameters: Accept inputs (arguments) to customize behavior.

3. Return Values: Functions can return outputs using the return statement.

4. Call: A function is executed when it’s called.

Python Packages

In Python, a package is a way to organize related modules (Python files) into a directory structure, making it easier to manage and reuse code. It allows for a hierarchical organization of the codebase.

Key Features of a Package

1.

Read More

Python Features, Modules, Loops, Functions, and Packages

Key Features of Python

  1. Simple and Easy to Learn:
    Python has a simple and readable syntax, which makes it easy for beginners to learn and understand. It emphasizes readability and reduces the cost of program maintenance.

  2. Interpreted Language:
    Python is an interpreted language, meaning that Python code is executed line by line by the interpreter. This makes debugging easier and faster.

  3. Dynamically Typed:
    Python does not require variable declaration before use. The data type of a variable is inferred

Read More

Windows MSC File and Registry Commands

Computer Management and System Tools

compmgmt.msc provides access to various system consoles:

  • ciadv.msc: Indexing Service (speeds up hard disk searches)
  • wmimgmt.msc: Windows Management Instrumentation (WMI) configuration
  • services.msc: Local Service Manager
  • diskmgmt.msc: Hard Disk Manager
  • dfrg.msc: Hard Drive Defragmenter
  • ntmsmgr.msc: Removable storage device management
  • devmgmt.msc: Device Manager
  • lusrmgr.msc: Local users and groups management
  • fsmgmt.msc: Shared resource management
  • gpedit.msc: Group Policy
Read More