Essential Algorithms: Complexity, Divide and Conquer, and KMP

1. Space Complexity

The space complexity of an algorithm is the amount of memory it needs to run to completion. The space required by a program includes the following components:

  • Instruction space: The space needed to store the compiled version of the program instructions.
  • Data space: The space needed to store all constant and variable values. This includes:
    • Space needed by constants and simple variables.
    • Space needed by dynamically allocated objects such as arrays and class instances.
  • Environment stack
Read More

Information Retrieval Systems: Core Concepts and Models

Information Retrieval Systems: Definition, Goals, and Applications

1. Definition

Information Retrieval (IR) is the process of finding relevant information (documents) from a large collection based on a user’s query. It deals with searching, storing, and retrieving unstructured data, such as text documents.

2. Goals of IR

  • Retrieve relevant documents: Only useful results should be shown to the user.
  • Reduce irrelevant results: Avoid unnecessary or wrong information.
  • Fast retrieval: Results should be returned
Read More

REST and SOAP API Development Essentials

API Documentation and Swagger

How is API documentation generated using Swagger and OpenAPI?
✅ By annotating the code with Swagger annotations.

What is one of the main advantages of using Swagger for API documentation?
✅ It automatically generates interactive documentation.

How does implementing clear annotations in code enhance code readability?
✅ By providing descriptive comments and clarifications.

HTTP Status Codes and Methods

Which HTTP status code is typically used to indicate that a resource

Read More

Artificial Intelligence Reasoning: Knowledge-Based Agents

1. Knowledge-Based Agents: Vacuum Cleaners

Two vacuum-cleaner agents operate in the same room:

  • Agent 1: Follows fixed rules: “If dirt detected, then suck; if bump, then turn right.”
  • Agent 2: Builds an internal map of where dirt and obstacles might be, updates it as it moves, and decides its next action.

Question: Explain why Agent 2 is considered a knowledge-based agent and how this capability changes the intelligence of its behavior compared to Agent 1.

Answer: Agent 2 maintains an internal knowledge

Read More

Database Management Systems: Exam Questions and Solutions

Database Exam Solutions

2025 Q&A

(a) Q: A minimum cardinality of 0 specifies ______ type of participation.
Ans: Partial participation


(b)

Q: Let E1 and E2 be two entity sets with relationships R1 (1:M) and R2 (no attributes). What is the minimum number of tables required?
Ans: 2 tables


(c)

Q: Stud has 120 tuples and Enroll has 8 tuples. What are max and min tuples in Stud NATURAL JOIN Enroll?
Ans:

  • Maximum = 8
  • Minimum = 0

(d)

Q: Which normal form is considered adequate for normal relational database design?

Read More

NLP with Python: Morphological Analysis and N-Grams

NLP Tasks with NLTK

Aim

Write a Python program to:

  • Perform morphological analysis using the NLTK library.
  • Generate n-grams using the NLTK n-grams library.
  • Implement n-gram smoothing.

Description

  1. Morphological Analysis: This involves analyzing word structures to understand meaning and grammatical properties. NLTK provides tools like stemming and lemmatization for this purpose.
  2. N-Grams Generation: N-grams are contiguous sequences of n items from a text. NLTK provides functions to generate these from tokenized
Read More