Samual Sam has Published 2496 Articles

Concatenate string to an int value in Java

Samual Sam

Samual Sam

Updated on 22-Oct-2023 03:25:06

24K+ Views

To concatenate a string to an int value, use the concatenation operator.Here is our int.int val = 3;Now, to concatenate a string, you need to declare a string and use the + operator.String str = "Demo" + val;Let us now see another example.Example Live Demoimport java.util.Random; public class Demo {   ... Read More

Asymptotic Notations

Samual Sam

Samual Sam

Updated on 21-Oct-2023 13:35:37

26K+ Views

Asymptotic NotationsAsymptotic notations are used to represent the complexities of algorithms for asymptotic analysis. These notations are mathematical tools to represent the complexities. There are three notations that are commonly used.Big Oh NotationBig-Oh (O) notation gives an upper bound for a function f(n) to within a constant factor.We write f(n) ... Read More

How to find Min/Max numbers in a java array?

Samual Sam

Samual Sam

Updated on 07-Oct-2023 02:52:33

26K+ Views

You can find the minimum and maximum values of an array using for loops −ExampleLive Demopublic class MinAndMax {    public int max(int [] array) {       int max = 0;             for(int i=0; imax) {             max = array[i];          }       }       return max;    }    public int min(int [] array) {       int min = array[0];             for(int i=0; i

Convert a String to Uppercase in C

Samual Sam

Samual Sam

Updated on 04-Oct-2023 14:05:42

28K+ Views

Here is the program to convert a string to uppercase in C language,Example#include #include int main() {    char s[100];    int i;    printf("Enter a string : ");    gets(s);    for (i = 0; s[i]!='\0'; i++) {       if(s[i] >= 'a' && s[i] = 'a' && s[i]

Pointer to an Array in C

Samual Sam

Samual Sam

Updated on 14-Sep-2023 21:15:58

26K+ Views

Pointers are variables which stores the address of another variable. When we allocate memory to a variable, pointer points to the address of the variable. Unary operator (*) is used to declare a variable and it returns the address of the allocated memory. Pointers to an array points the address ... Read More

Array Copy in Java

Samual Sam

Samual Sam

Updated on 13-Sep-2023 15:09:03

27K+ Views

Array in Java can be copied to another array using the following ways.Using variable assignment. This method has side effects as changes to the element of an array reflects on both the places. To prevent this side effect following are the better ways to copy the array elements.Create a new ... Read More

Check if a Java ArrayList contains a given item or not

Samual Sam

Samual Sam

Updated on 13-Sep-2023 13:01:11

32K+ Views

The java.util.ArrayList.contains() method can be used to check if a Java ArrayList contains a given item or not. This method has a single parameter i.e. the item whose presence in the ArrayList is tested. Also it returns true if the item is present in the ArrayList and false if the ... Read More

How to find the index of an item in a C# list in a single step?

Samual Sam

Samual Sam

Updated on 09-Sep-2023 23:28:21

34K+ Views

To get the index of an item in a single line, use the FindIndex() and Contains() methods.int index = myList.FindIndex(a => a.Contains("Tennis"));Above, we got the index of an element using the FindIndex(), which is assisted by Contains() method for that specific element.Here is the complete code −Example Live Demousing System; using ... Read More

C++ Program to Find Fibonacci Numbers using Recursion

Samual Sam

Samual Sam

Updated on 06-Sep-2023 21:11:54

51K+ Views

The following is an example of fibonacci series using recursion.Example Live Demo#include using namespace std; int fib(int x) {    if((x==1)||(x==0)) {       return(x);    }else {       return(fib(x-1)+fib(x-2));    } } int main() {    int x , i=0;    cout x;    cout

Framing in Data Link Layer

Samual Sam

Samual Sam

Updated on 06-Sep-2023 20:59:49

49K+ Views

In the physical layer, data transmission involves synchronised transmission of bits from the source to the destination. The data link layer packs these bits into frames. Data-link layer takes the packets from the Network Layer and encapsulates them into frames. If the frame size becomes too large, then the packet ... Read More

Advertisements