Sorting, Heaps, and Graph Algorithms

Merge sort:


#include <stdio.H>

#include <stdlib.H>

#include <string.H>

#define MAX 10000

Int noofcomparision = 0;


Void merge(int arr[], int l, int mid, int h) {

Int n1 = mid + 1 – l;


Int n2 = h – mid;


Int a[n1], b[n2];


For (int i = 0; i < n1; i++) {

A[i] = arr[i + l];


    }

For (int i = 0; i < n2; i++) {

B[i] = arr[i + mid + 1];


    }

Int i = 0, j = 0, k = l;


While (i < n1 && j < n2) {

Noofcomparision++;


        if (a[i] <= b[j]) {

            arr[k] = a[i];

 

Read More

Understanding Computer Fundamentals: Data, Devices, and Memory

Why People Prefer Computers

Computers work faster than humans, find information quickly, store data efficiently, and operate tirelessly.

Data Types

Numeric: Integer and real.

Text: String.

Graphics: Pictures.

Date

Sound

Input Devices

Concept Keyboards

A flat board with programmable keys, used in primary education.

Light Pen

A pen-shaped wand with light sensors to select objects on screen.

Touch Screen

A flat screen that detects touch using infrared lasers, commonly found in restaurants.

OMR (Optical Mark Recognition)

Read More

DBMS Essentials: Organization, Integrity, and Access

Database Management Systems (DBMS)

A DBMS is a software suite designed to access and manage databases. A database is a structured collection of related data.

Challenges of File Management

  • Data Redundancy and Inconsistency: Data duplication across various files and formats.
  • Physical-Logical Data Dependency: Changes in data structure require program modifications.
  • Difficulty in Data Access: Accessing data requires specific program code for each query.

Database Systems

A database is a large, organized store

Read More

Cache and Virtual Memory Management

Cache and Virtual Memory

Cache Analysis

Considering the data and the accompanying table for direct correspondence with caches and block size of 32 bytes, taken on a set of test programs where the percentage of references to instructions is 75%, answer the following:

  1. Which system has a lower miss rate: a 16KB instruction cache and a 16KB data cache, or a unified 32KB cache?
  2. Assume a cache hit takes one clock cycle, a miss costs 50 cycles, and a hit in a load or store requires an extra cycle in the case
Read More

VBA UserForm Data Entry Automation

Activating UserForm1

This section initializes the UserForm1 by populating the ComboBox1 with city names.

Private Sub UserForm_Activate()

ComboBox1.AddItem "Rancaguita"

ComboBox1.AddItem "Santiaguitito"

ComboBox1.AddItem "Viñitita"

ComboBox1.AddItem "Concepcioncito"

ComboBox1.AddItem "Chaitencitito"

ComboBox1.AddItem "La Serena"

ComboBox1.Text = "Select an Option"

End Sub


Navigating Controls

This code moves the cursor to the next control after selecting an item in ComboBox1.

Private Sub ComboBox1_Click()

ComboBox1.

Read More

Operating System Evolution and Core Concepts

Introduction

The evolution of operating systems (OS) parallels hardware advancements. Hardware generations saw changes in technology components:

  • Valves (1st Generation)
  • Transistors (2nd Generation)
  • Integrated Circuits (3rd Generation)
  • Large-scale and very-large-scale integrated circuits (4th Generation)

Operating System Evolution

Generation 0 (1940)

Computational systems without OS. Users accessed machine language directly. Hand-coding and punch-card machines were used.

First Generation (1950s)

Early OS designed

Read More