Found 35164 Articles for Programming

Convert ArrayList to LinkedHashMap in Java

Rudradev Das
Updated on 19-Jan-2024 18:29:56

141 Views

The LinkedHashMap Class is an one type of Hash Map which enables an user to maintain a systematic cronology of the elements present into it. This feature also provides the method of insertion, search and deletion in a quick manner. When we need to convert an array list to a linked hash map, we need to set a key value for this and it reflects as the index of an array list. In terms of the process of the iteration and the data sorting, array list and linked hash map; both are same in nature. Here is a general example ... Read More

Convert ArrayList to HashMap in Java

Rudradev Das
Updated on 19-Jan-2024 18:24:42

257 Views

In Java the List is a child interface class which can also represents a Collection set. It is an ordered collection set, consists of the objects where duplicate values can be sorted also. Java array list is a collection framework as it presents into the java.util package and provides the dyanamic array elements in Java. For the ArrayList we do not have to mention the size of the list. On the other hand, the HashMap is a Java collection which can be found as a package in java.until. It contains the data values as a pair of (Key, Value).Basically, there ... Read More

Proxy Design Pattern for Object Communication in Python

Devesh Chauhan
Updated on 19-Jan-2024 10:34:24

35 Views

Classes and objects are the fundamental elements of programming. These entities construct the entire logic and controls the access to different parts of the code. There could be a situation where we are restricted by the complexity of the operation and therefore, we require an efficient and optimized solution. The Proxy Design Pattern is one such powerful technique of creating a proxy class instead of an instance of the real class. In this article, we will be exploring the basics of this technique and understand how we can use it to solve problems involving huge amount of data. Let’s begin ... Read More

Protected variable in Python

Devesh Chauhan
Updated on 19-Jan-2024 10:26:25

93 Views

In programming the concept of protected variable is used to create an access control system. In this system, we establish a hierarchy or level of access control. This concept solidifies the basis of object-oriented programming. The technical meaning of a protected variable remains the same but the syntax and behaviour may vary between different programming languages. Python follows the conventional logic of accessing and manipulating the attributes and methods, but the representation and degree of enforcement of access control is a little different. Understanding Protected Variables in Python Protected variables in python manages the internal use of the attributes and ... Read More

Number of palindromic subsequences of length k where k <= 3

Riya Kumari
Updated on 05-Jan-2024 16:11:39

121 Views

Palindromes are series of letters, numbers or characters which have same starting and ending point. Also, they are same when read from left to right and right to left. A subsequence of a string is a new string which is made by removing some of the characters from the original string without changing the relative order of the characters which are remaining. Suppose you are given a string of length N. You want to find palindromic subsequences of length K from the string. Note that value of K can be less than or equal to 3. In this article, we ... Read More

Number of palindromic paths in a matrix

Riya Kumari
Updated on 05-Jan-2024 16:10:04

70 Views

Palindromic pathways are very useful in solving various problems involving patterns and sequences. It can be used in finding correct path in a maze without reversing, palindromes in a sequence of letters, etc., It can also be used to identify symmetric patterns and structures. In this article, we will discuss about palindromic paths and ways to find such paths in a matrix using C++. Palindromes are series of letters, numbers or characters which have same starting and ending point. Also, they are same when read from left to right and right to left. A path in a matrix is a ... Read More

Number of palindromic permutations

Riya Kumari
Updated on 05-Jan-2024 16:08:18

57 Views

Permutations are possible in strings as well as numbers. A string can have permutations equal to the factorial of its number of characters. These permutations can be palindromic under certain circumstances. In this article, we will discuss about how palindromic permutations occur in a string. We will also find the number of palindromic permutations possible in a string using C++. Permutation is a mathematical process of rearranging the letters or characters from a specified string or words. In other words, it is rearrangement of objects or elements in an order. A palindrome is a set of character which are same ... Read More

Number of ordered pairs such that Ai & Aj = 0

Riya Kumari
Updated on 05-Jan-2024 16:04:48

47 Views

Suppose you are given an array and you have to find the total count of ordered pairs formed such that Ai & Aj = 0. You are given an array A[A1, A2, A3, …An]. You have to find ordered pairs of Ai and Aj such that their bitwise AND operation will give the result equal to 0. In other words, you have to count the pairs of elements (i, j) whose bitwise AND operation is zero. For example, we have an array [3, 4, 2]. The binary representation of each element are as follows − A1 = 3 = ... Read More

Number of n digit stepping numbers - space optimized solution

Riya Kumari
Updated on 05-Jan-2024 16:02:29

45 Views

In this article, we will learn about stepping numbers. We will find the possible number of n digit numbers which are also stepping numbers using several C++ techniques. We will also discuss about the most space optimized solution. Let’s first discuss about stepping numbers. These are such numbers which have adjacent digits in such a way that they all have a difference of 1. For example, 321- each of the adjacent digits (3, 2, 1) have a difference of 1 consecutively. Here, we will be given the value of N and then we have to find the count of all ... Read More

Number of n digit numbers that do not contain 9

Riya Kumari
Updated on 05-Jan-2024 16:01:04

53 Views

Suppose you have a given number N. Now, you want to find those numbers of N digit which do not contain 9. This question can be solved by permutation and combination mathematically. In this article, we will find such numbers and count them using C++. Suppose you have to find 1-digit numbers which do not contain 9. So, these numbers are (0 – 8). There are in total 8 such numbers. Similarly, we have to find the count of N digit such numbers. Here, we will be given the value of N and then we have to find the count ... Read More

Previous 1 ... 4 5 6 7 8 ... 3517 Next
Advertisements