Found 1862 Articles for Data Structure

C++ Program for Left Rotation and Right Rotation of a String

Prabhdeep Singh
Updated on 11-Jul-2023 08:56:40

668 Views

Rotation means we have to shift each character forward or backward direction. In the case of forward, the last character is forwarded to the index 0 also known as right rotation. In the case of backward first character at index 0 is backward to the last index also known as left rotation. In this problem, we have given a string of characters and integer d. Our task is to print the left rotated string or right rotated string by d integer. Only the permutation of the current string changes, not the length or frequency of the characters in the ... Read More

How to Deploy Redis Cluster on Kubernetes?

Satish Kumar
Updated on 10-Jul-2023 18:41:29

1K+ Views

Introduction Redis is a widely used open-source, in-memory data structure store, used as a database, cache, and message broker. It is designed to handle a large set of data structures with high performance and flexibility. Redis Cluster is a distributed implementation of Redis that provides high availability and scalability through partitioning the dataset across multiple nodes. Prerequisites Understanding of Kubernetes Architecture Before diving into deploying Redis Cluster on Kubernetes, it is crucial to have a basic understanding of Kubernetes architecture. This involves knowing the main components of a Kubernetes cluster, such as nodes, pods, and services. Understanding how these ... Read More

Role of Data Structure and Algorithms in Machine Learning

Devang Delvadiya
Updated on 09-Jun-2023 17:00:17

910 Views

Machine learning is a growing field in technology that has changed many industries, like healthcare and finance. It has helped with things like language processing, image recognition, and making predictions. Data structures and algorithms play an important role in machine learning, helping to solve complex problems. In this article, we will look at the role of data structures and algorithms in machine learning and how they help to solve complex problems. Before we discuss the role of data structures and algorithms in machine learning, it is important to have a clear understanding of what these terms mean. A data structure ... Read More

Sum of frequencies of characters of a string present in another string

Siva Sai
Updated on 27-Oct-2023 16:10:22

544 Views

In this article, we are going to explore an interesting problem related to string manipulation using various programming languages. The problem statement is "Sum of frequencies of characters of a string present in another string". This problem provides a great opportunity to enhance your understanding of string operations, character frequency calculation, and the concept of mapping in C, C++, Java and Python. Problem Statement Given two strings, the task is to find the sum of frequencies of characters of the first string that are present in the second string. Solution Approach To solve this problem, we will first create frequency ... Read More

string__npos in C++ with Examples

Siva Sai
Updated on 18-May-2023 14:10:08

1K+ Views

In this article, we will delve into a specific aspect of string handling in C++: the string::npos constant. string::npos is a static member constant value with the greatest possible value for an element of type size_t. This constant is defined with a value of -1, which, when cast to size_t, gives us the largest possible representation for size_t. In the context of strings in C++, it is generally used to indicate an invalid position. What is String::npos? In C++, string::npos is a constant static member of the std::string class that represents the maximum possible value for the size_t type. It ... Read More

Sort an array of strings in ascending order with each string sorted in descending order

Siva Sai
Updated on 27-Oct-2023 16:02:29

294 Views

In this article, we dive into a unique and interesting problem related to arrays and string manipulation in various programming languaues. The problem at hand is "Sort an array of strings in ascending order with each string sorted in descending order". This problem is an excellent way to enhance your knowledge of string manipulation, arrays, and sorting algorithms. Problem Statement Given an array of strings, the task is to sort the array in ascending order, but with each string sorted in descending order. Solution Approach We can solve this problem by using the sort function provided by the C++ Standard ... Read More

Remove all occurrences of a word from a given string using Z-algorithm

Siva Sai
Updated on 27-Oct-2023 15:50:54

219 Views

This article delves into an interesting string manipulation problem: "Remove all occurrences of a word from a given string using Z-algorithm". This problem serves as an excellent use case for the Z-algorithm, highlighting its efficacy in pattern searching problems. Let's explore in detail. Problem Statement Given a string S and a word W, the task is to remove all occurrences of W from S using the Z-algorithm. Understanding the Problem Consider a string S = "HelloWorldHelloWorld" and a word W = "World". The goal is to remove all occurrences of W from S. Hence, the output would be "HelloHello". Z-algorithm ... Read More

Rearrange a string to maximize the minimum distance between any pair of vowels

Siva Sai
Updated on 27-Oct-2023 15:48:55

142 Views

In this article, we are going to unravel an interesting problem from the domain of string manipulation: "Rearrange a string to maximize the minimum distance between any pair of vowels". This problem challenges us to manipulate the arrangement of characters in a string to ensure the maximum possible minimum distance between any two vowel characters. We'll discuss the problem in detail, providing the various programs. Understanding the Problem Statement Given a string, the task is to rearrange the characters in the string in such a way that the minimum distance between any pair of vowels is maximized. In other words, ... Read More

Other Primary File Organizations

Mithlesh Upadhyay
Updated on 18-May-2023 17:25:25

270 Views

Files of Mixed Records In DBMS, file organizations are designed to handle records of a single type. However, in most real-world applications, multiple types of entities are interconnected in various ways. To represent relationships among records in different files, fields are connected. For example, a STUDENT record may have a connecting field Major_dept, whose value gives the name of the DEPARTMENT in which the student is majoring. The Major_dept field refers to a DEPARTMENT entity, which should be represented by a record of its own in the DEPARTMENT file. Retrieving field values from two related records requires retrieving one of ... Read More

Random password generator in C

Siva Sai
Updated on 18-May-2023 14:00:09

1K+ Views

In this article, we will delve into an interesting and practical problem related to string manipulation in C programming. We are going to build a "Random Password Generator" in C. This problem not only enhances your understanding of string manipulation but also your knowledge of the C Standard Library. Problem Statement The task is to build a program that generates a random password of a specified length. The password should include uppercase and lowercase alphabets, digits, and special characters. C Solution Approach To solve this problem, we'll leverage the power of the C Standard Library. We'll use the rand() function ... Read More

Advertisements