Data Structure Articles

Page 3 of 164

Multilevel Indexes

Mithlesh Upadhyay
Mithlesh Upadhyay
Updated on 14-Mar-2026 18K+ Views

In RDBMS, indexes are data structures that speed up data retrieval by reducing disk accesses. As databases grow, single-level indexes become too large for main memory. Multilevel indexes solve this by dividing the index into a hierarchy of smaller, manageable blocks. Index Components Search Key Sorted primary/candidate key points to Data Reference Pointer to disk ...

Read More

Difference between Inverted Index and Forward Index

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 2K+ Views

Inverted Index and Forward Index are data structures used to search text within a document or a collection of documents. They differ in how they map the relationship between words and documents − one indexes by word, the other by document. Forward Index A forward index stores the document name as the key and maps it to the list of words contained in that document. It answers the question: "What words does this document contain?" Inverted Index An inverted index stores each word as the key and maps it to the list of documents that contain ...

Read More

Difference between Linear and Non-linear Data Structures

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 21K+ Views

Data structures are classified into linear and non-linear based on how their elements are arranged and connected. Understanding this distinction is fundamental to choosing the right data structure for a given problem. Linear Data Structures A linear data structure has data elements arranged in a sequential manner where each element is connected to its previous and next element. This sequential connection allows traversal in a single run. Linear data structures are easy to implement because computer memory is also organized sequentially. Examples include Array, List, Queue, and Stack. Non-linear Data Structures A non-linear data structure has ...

Read More

Add and Search Word - Data structure design in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 545 Views

Suppose we have to design a data structure that supports the following two operations −addWord(word)search(word)The search(word) method can search a literal word or a regular expression string containing only letters a-z or .. A . means it can represent any one letter. So for example, if we add some words like “bad”, “dad”, “mad”, then search for search(“pad”) → false, search(“bad”) → true, search(“.ad”) → true and search(“b..”) → trueTo solve this, we will follow these steps −There are some methods, initially define insertNode(), this will take the head reference and the string s, this will work as follows −curr ...

Read More

Find the Longest Common Substring using Binary search and Rolling Hash

Farhan Muhamed
Farhan Muhamed
Updated on 06-Aug-2025 563 Views

In this article, we will explain the concept of rolling hash and find the longest common substring using binary search and rolling hash. We will also provide a C++ code implementation for the same. Rolling Hash of a String Problem Statement Algorithm to Find the Longest Common Substring C++ Code Implementation Time and Space Complexity Rolling Hash of a String Rolling hash is a cryptographic technique used to calculate the hash value of a string. In this, we ...

Read More

Activity Selection Problem

Ravi Ranjan
Ravi Ranjan
Updated on 21-Jul-2025 9K+ Views

Activity Selection Problem The activity selection problem is an example of a greedy algorithm where the maximum number of non-overlapping activities are selected from the given activity set. A person can complete one activity at a time. The activities are given in the form of their starting and completion times. In this article, we have an array of integers that stores the starting and completion time of each activity. Our task is to select the maximum number of non-overlapping activities from the given activity array. Scenario An example of the maximum activity ...

Read More

Java Program to Implement the Linear Congruential Generator for Pseudo Random Number Generation

Alshifa Hasnain
Alshifa Hasnain
Updated on 29-Mar-2025 675 Views

In this article, we will implement the linear congruential generator for pseudo random number generation in Java. Pseudo random number generator (PRNG) are mainly used in simulations, cryptography, or mathematical tasks. What is an LCG? A Linear Congruential Generator (LCG) is a technique to generate a sequence of numbers that looks like random numbers but are actually determined. It is one of the reasons to call it a pseudo-random number. The Linear Congruential Generator (LCG) technique generates a random number based on the previous number and uses linear recurrence to generate the sequence of the random number. Mathematical Formula We can ...

Read More

Different Types of Database Users

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 14-Feb-2025 40K+ Views

Database users interact with data to update, read, and modify the given information daily. There are various types of database users and we will learn in detail about them. Database users can be divided into the following types − Naive users / Parametric users Sophisticated users End Users Application Programmer or Specialized users or Back-End Developer System Analyst Database Administrator (DBA) Temporary Users or Casual Users These users can access the database and recover the data using various applications. Let’s have a quick understanding of all the types in detail − End Users/Parametric Users These users access the ...

Read More

Java Math subtractExact(long x, long y) method

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 28-Jan-2025 570 Views

We will discuss the Java Math subtractExact(long x, long y) method in Java and understand its functionalities and working. The subtractExact()is an inbuilt function in the Java Math library. The function returns the difference between the two parameters passed as arguments in the function. The function returns an exception when the returned value overflows the range of values of a particular data type. It is the most commonly used class for mathematical operations is the java.lang.Math class is a part of the Java Standard Library and is included in the java.lang package. Syntax Following is the syntax of the subtractExact() function ...

Read More

Java Program for Minimum Rotations Required to Get the same String

Alshifa Hasnain
Alshifa Hasnain
Updated on 17-Dec-2024 467 Views

In this article, we will learn to count the total number of minimum required rotations to get the original string in Java. We can solve the problem by getting the rotations substrings of the original string or concatenating the original string to itself.  Problem statement We have given string str of length N. The task is to find the total number of minimum rotations we need to perform to get the original string. Input 1 str = "bcdbcd"; Output 1 3 Explanation − We need to make 3 rotations to get the original string. ...

Read More
Showing 21–30 of 1,635 articles
« Prev 1 2 3 4 5 164 Next »
Advertisements