Notes, summaries, assignments, exams, and problems for Computers

Sort by
Subject
Level

Core Concepts in Artificial Intelligence: Search Algorithms and Knowledge Systems

Classified in Computers

Written on in English with a size of 15.96 KB

Heuristic Search Techniques Explained

Heuristic search techniques use intelligent estimations to find solutions efficiently. These methods help in decision-making by prioritizing the most promising paths.


1. Greedy Best-First Search (GBFS)

  • Always chooses the next step that appears closest to the goal.
  • Ignores the cost already traveled.

Example:

A person finding the exit of a maze by always taking the path that looks shortest.

Risk: May lead to dead ends.


2. A* Search Algorithm

  • Balances actual cost and estimated cost to reach the goal.
  • Ensures the shortest and most efficient path.

Example:

Google Maps finds the best route by considering both distance already covered and the remaining estimated distance.

Optimal and efficient.


3. Hill Climbing Algorithm

  • Moves
... Continue reading "Core Concepts in Artificial Intelligence: Search Algorithms and Knowledge Systems" »

Hehhrhrhr

Posted by Anonymous and classified in Computers

Written on in English with a size of 9.2 KB

Sequential circuits are fundamental components of digital systems, defined by the fact that their output depends not only on the current inputs but also on the past history of inputs (i.E., their current state).
The most basic element of a sequential circuit is the Flip-Flop, which is a 1-bit memory cell.
Here is a detailed explanation of the basic Flip-Flops and their operation:
1. Latches vs. Flip-Flops
Both latches and flip-flops are 1-bit storage elements, but they differ in how they are controlled:
| Feature | Latch | Flip-Flop |
|---|---|---|
| Triggering | Level-triggered (Transparent) | Edge-triggered (Synchronous) |
| Control | Changes state as long as the Enable or Clock is HIGH (or LOW). | Changes state only at the rising edge or falling... Continue reading "Hehhrhrhr" »

Java AWT: Button Events and Arrow Key Shape Movement

Classified in Computers

Written on in English with a size of 3.75 KB

Button Click Action Events

import java.awt.*;

import java.awt.event.*;

public class ButtonClickActionEvents

{

public static void main(String args[])

{

Frame f=new Frame("Button Event");

Label l=new Label("DETAILS OF PARENTS");

l.setFont(new Font("Calibri",Font.BOLD, 16));

Label nl=new Label();

Label dl=new Label();

Label al=new Label();

l.setBounds(20,20,500,50);

nl.setBounds(20,110,500,30);

dl.setBounds(20,150,500,30);

al.setBounds(20,190,500,30);

Button mb=new Button("Mother");

mb.setBounds(20,70,50,30);

mb.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

nl.setText("NAME: " + "Aishwarya");

dl.setText("DESIGNATION: " + "Professor");

al.setText("AGE: " + "42");

}

});

Button fb=new Button("Father");

fb.setBounds(80,70,50,30);

fb.addActionListener(

... Continue reading "Java AWT: Button Events and Arrow Key Shape Movement" »

Mastering Relational Algebra for Database Queries

Classified in Computers

Written on in English with a size of 4.53 KB

Relational Algebra Fundamentals

  • Relational Algebra is a mathematical query language used in databases.
  • The result of any operation is always another relation (table).

Relational Algebra Operations Explained

Unary Relational Operations

SELECT (σ) – Filters Rows

  • Retrieves specific rows from a table based on a condition.
  • Syntax: σ (condition) (Relation)
  • Example: σ (Dept_ID = 4) (EMPLOYEE)

PROJECT (π) – Filters Columns

  • Retrieves specific columns from a table.
  • Syntax: π (column1, column2) (Relation)
  • Example: π (Name, Salary) (EMPLOYEE)

RENAME (ρ) – Changes Table or Column Name

  • Syntax: ρ (NewTable (NewColumn1, NewColumn2), OldTable)
  • Example: ρ (Staff (Emp_ID, FullName), EMPLOYEE)

Set Theory Operations

UNION (∪) – Combines Two Tables

  • Combines tuples
... Continue reading "Mastering Relational Algebra for Database Queries" »

C Programming: Tokens, Operators, and Logic

Classified in Computers

Written on in English with a size of 2.55 KB

Tokens

In programming, a token is the smallest meaningful element in code. They are the building blocks of a language's syntax. Common token types include:

  • Keywords: Reserved words like if, else, while, and int (for declaring integers).
  • Identifiers: Names given to elements like variables (e.g., sum), functions, and arrays.
  • Constants: Unchanging values during program execution (e.g., 3.14 for pi).
  • Operators: Symbols for mathematical or logical operations (e.g., + for addition).
  • Separators: Punctuation like commas (,), semicolons (;), and braces ({}).

Example: int sum = 10 + 5;

In this line, int is a keyword, sum is an identifier, = is an operator, 10 and 5 are constants, and ; is a separator.

Arithmetic Operators

C has nine arithmetic operators for basic... Continue reading "C Programming: Tokens, Operators, and Logic" »

Core Concepts in AI, Machine Learning, and Industrial Automation Systems

Posted by Anonymous and classified in Computers

Written on in English with a size of 422.57 KB

Linear Regression Fundamentals

In regression, a set of records containing X and Y values is used to learn a function. This learned function can then be used to predict Y from an unknown X. In regression, we aim to find the value of Y, so a function is required which predicts Y given X. Y is continuous in the case of regression.

Here, Y is called the criterion variable and X is called the predictor variable. There are many types of functions or models which can be used for regression. The linear function is the simplest type of function. Here, X may be a single feature or multiple features representing the problem.

P37C38P9ECJqqvMXffAAAAAElFTkSuQmCC

Applications of Linear Regression in AI

  • Predictive Analysis: Forecasting sales, stock prices, or house prices based on historical data.
... Continue reading "Core Concepts in AI, Machine Learning, and Industrial Automation Systems" »

Dijkstra's Algorithm in C: Code & Explanation

Classified in Computers

Written on in English with a size of 3.5 KB

Dijkstra's Algorithm in C

This code implements Dijkstra's algorithm to find the shortest path from a source vertex to all other vertices in a graph represented as an adjacency matrix. The program reads graph data from an input.txt file and writes the results to an output.txt file.

Code Implementation


#include <stdio.h>
#include <limits.h>
#include <stdbool.h>

#define MAX_VERTICES 100

// Function to find the vertex with minimum distance
int minDistance(int dist[], bool visited[], int vertices) {
    int min = INT_MAX, min_index;

    for (int v = 0; v < vertices; v++)
        if (!visited[v] && dist[v] <= min) {
            min = dist[v];
            min_index = v;
        }

    return min_index;
}

// Dijkstra'
... Continue reading "Dijkstra's Algorithm in C: Code & Explanation" »

Data Structures: Queues, Trees, Graphs, and Searching Algorithms

Posted by Anonymous and classified in Computers

Written on in English with a size of 497.48 KB

Understanding Data Structures and Algorithms

8. Queues: FIFO Operations

A queue is a linear data structure that follows the First-In, First-Out (FIFO) principle. The element inserted first will be removed first, similar to people waiting in a line. It has two primary operations:

  • enqueue(): Adds an element to the rear of the queue.
  • dequeue(): Removes an element from the front of the queue.

Enqueue Operation Algorithm (Array-based):

  1. Check if the queue is full (rear == size - 1).
  2. If not full, increment rear.
  3. Insert the new element at queue[rear].

Example:

if (rear == size - 1)
    printf("Queue Overflow");
else {
    rear++;
    queue[rear] = value;
}

Dequeue Operation Algorithm:

  1. Check if the queue is empty (front > rear).
  2. If not empty, retrieve the element
... Continue reading "Data Structures: Queues, Trees, Graphs, and Searching Algorithms" »

Fundamental Computer Science Concepts & Algorithms

Classified in Computers

Written on in English with a size of 1.64 MB

Arithmetic Progressions (AP)

Sum of terms = n[(1st term + last term)]/2

Geometric Progressions (GP)

Sum of terms = [1st term(1 - quotientn)/(1 - quotient)] (Swap positions of 1 & quotient if quotient > 1)

Logarithms

  • loga(x/y) = logax - logay
  • logaxn = nlogax
  • logab = (logcb/logca)

Permutations

For a set of n objects: The total number of permutations is n!

For arranging 'r' objects from a set of 'n' objects: The number of permutations is nPr = n! / (n-r)!. (e.g., ways to arrange 3 objects from a set of 5 is 5 * 4 * 3, since there are 5 possibilities for the first object, followed by 4, then 3.)

Combinations

For selecting 'r' objects from a set of 'n' objects: The number of combinations is nCr = n! / (r! * (n-r)!). (Divide by r! since there are r! ways

... Continue reading "Fundamental Computer Science Concepts & Algorithms" »

C Programming Concepts: Arrays, Functions, Structures, and Stacks

Posted by Anonymous and classified in Computers

Written on in English with a size of 300.77 KB

1. Arrays: Definition, Types, and Implementation

An array is a collection of elements of the same data type stored in contiguous memory locations. It is used to store multiple values in a single variable and can be accessed using index numbers. The indexing in an array starts from 0. Arrays help manage and process data efficiently, especially when dealing with large volumes of similar data.

Types of Arrays Based on Dimensions

  • One-Dimensional Array: It stores data in a linear list format.
  • Multi-Dimensional Array: It stores data in matrix form (like 2D, 3D arrays), which is useful in applications like image processing and tables.

Types of Arrays Based on Memory Allocation

  1. Static Array:

    The size of the array is fixed at compile-time. Memory is allocated

... Continue reading "C Programming Concepts: Arrays, Functions, Structures, and Stacks" »