Nancy Den has Published 314 Articles

C++ Program to Find Fibonacci Numbers using Matrix Exponentiation

Nancy Den

Nancy Den

Updated on 25-Apr-2025 14:17:38

3K+ Views

The Fibonacci numbers, commonly denoted as F(n) forms a sequence, called the Fibonacci sequence. In Fibonacci series, each number is the sum of the two previous two numbers, starting from 0 and 1. It is represented as F(n) = F(n-1) + F(n-2). The matrix exponentiation method is used to calculate ... Read More

C++ Program to Find Fibonacci Numbers using Dynamic Programming

Nancy Den

Nancy Den

Updated on 21-Feb-2025 16:30:27

5K+ Views

In this article, we will learn how to calculate Fibonacci numbers efficiently using dynamic programming in C++. The Fibonacci sequence starts with 0 and 1, and each next number is the sum of the two preceding ones. The basic recursive method works but becomes very slow for larger numbers because ... Read More

C++ Program to Implement Bubble Sort

Nancy Den

Nancy Den

Updated on 21-Feb-2025 16:27:56

16K+ Views

Bubble sort is comparison based sorting algorithm. It works by going through the list, comparing each pair of numbers, and swapping them if they are in the wrong order. This process is repeated until the list is sorted. The name "bubble sort" comes from the way smaller numbers move to ... Read More

Java Program to fill elements in a float array

Nancy Den

Nancy Den

Updated on 10-Feb-2025 11:34:34

299 Views

In this article, we will learn how to fill elements in a float array in Java. The Arrays.fill() method is used to assign a specified value to each element of the array. Array fill() method The Arrays.fill() method in Java sets all elements of an array to a given value, ... Read More

C++ Program to Solve the 0-1 Knapsack Problem

Nancy Den

Nancy Den

Updated on 02-Dec-2024 00:26:20

6K+ Views

In the 0-1 knapsack problem, a set of items is given, each with a weight and a value. We need to determine the number of each item to include in a collection so that the total weight is less than or equal to the given limit and the total value is ... Read More

Java program to convert stream to typed array

Nancy Den

Nancy Den

Updated on 15-Nov-2024 18:45:03

287 Views

In this article, we will learn how to change a Java Stream into a typed array in Java. By using the toArray() method with a constructor reference, we can ensure that the array has the right type. Problem StatementGiven a Stream of strings, write a Java program to convert ... Read More

Java program to add period to LocalDate

Nancy Den

Nancy Den

Updated on 08-Nov-2024 22:29:57

566 Views

In this program, we will learn to add a specific period to a date using Java’s LocalDate class. By using Java's Period class, we can specify an amount of time (such as months and days) and then add this period to a LocalDate. The program demonstrates how to set a ... Read More

Java program to get the prime numbers with BigInteger type

Nancy Den

Nancy Den

Updated on 04-Nov-2024 18:44:41

538 Views

In this article, we will learn how to generate prime numbers using the BigInteger class in Java. A prime number is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. Here, we have the BigInteger type, which has operations ... Read More

Java program to generate random number with restrictions

Nancy Den

Nancy Den

Updated on 15-Oct-2024 10:40:36

1K+ Views

In this article, we will learn to generate random numbers with restrictions in Java. We will be using the Java Random class from java.util package. Random class Random class is imported from java.util package. The instance of this class is used to generate the random numbers and provides different numbers ... Read More

Java program to check if none of the string in the list matches the condition

Nancy Den

Nancy Den

Updated on 29-Sep-2024 02:47:46

768 Views

In this article, you will learn how to check if none of the strings in a list start with a specific letter using Java. This approach is useful for validating or filtering data. We will use the Stream API to evaluate the condition and return a boolean result based on ... Read More

1 2 3 4 5 ... 32 Next
Advertisements