Posts

Sort the array of 0's and 1's in java language.

🔗 code link-> click here 👇👇        👇👇  ■》Method 1-> two pass solution https://www.programiz.com/online-compiler/7YuDw6TTrtAZV ■》Method 2-> one pass solution   https://www.programiz.com/online-compiler/0NwsnO1PyBlMh

Reverse the array without using extra array [ two pointer/pass solution] in java.

🔗 Code link-> click here->👇         ðŸ‘‡ðŸ‘‡ https://www.programiz.com/online-compiler/9MLUbDFobnE5V

Program to reverse the array without using extra array [ one pass solution ]in java.

🔗 Code link-> click here 👇👇       ðŸ‘‡ https://www.programiz.com/online-compiler/52EuwUuWkfYIN

Program to find minimum element in array in java.

■》Code link 🔗 -> click here        👇👇👇 https://www.programiz.com/online-compiler/6lOwwbgfkXLNP

Find left middle element in even size linked list in java.

■》 Code link 🔗-> click 👇👇👇 https://www.programiz.com/online-compiler/1lOrmNP05XxF8 ■》 program-> import java.util.Scanner; class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtEnd(int val){     Node temp = new Node(val);     if(head==null) head=tail=temp;     else       {         tail.next=temp;         tail=temp;        }        size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }     ...

Set / update the value in linked list in java.

■》 Code link-> click 👇👇👇 https://www.programiz.com/online-compiler/8RZjEuY7ZCVC7 ■》 Program-> import java.util.Scanner; class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtEnd(int val){     Node temp = new Node(val);     if(head==null) head=tail=temp;     else       {         tail.next=temp;         tail=temp;        }        size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }       ...

Delete an element at the end of linked list in java.

■》Code link 🔗 -> click 👇👇👇 https://www.programiz.com/online-compiler/5XK4mKu63QU3u ■》Program-> class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtEnd(int val){     Node temp = new Node(val);     if(head==null) head=tail=temp;     else       {         tail.next=temp;         tail=temp;        }        size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }         System.out.println...

Delete an element from a given Index in linked list in java.

■》 Code link🔗 -> click👇👇👇 https://www.programiz.com/online-compiler/6fkgrxG1pyevE ■》Program->  class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtEnd(int val){     Node temp = new Node(val);     if(head==null) head=tail=temp;     else       {         tail.next=temp;         tail=temp;        }        size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }         System.out.pr...

Delete an element at the starting of linked list in java.

Code link 🔗 -> click 👇👇👇👇 https://www.programiz.com/online-compiler/7xP5aBU4Orcx8 ■》Program-> class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtEnd(int val){     Node temp = new Node(val);     if(head==null) head=tail=temp;     else       {         tail.next=temp;         tail=temp;        }        size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }         System.out.println...

Get data / value of a node in linked list in java.

■》Code link-> click 👇👇👇 https://www.programiz.com/online-compiler/0kNflMEyTAhkz ■》Program-> import java.util.Scanner; class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtEnd(int val){     Node temp = new Node(val);     if(head==null) head=tail=temp;     else       {         tail.next=temp;         tail=temp;        }        size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }       ...

Insert the element at given index in Linked list in java.

 class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtIndex(int x,int val){         if(x==0){             Node temp = new Node(val);             head=temp;             size++;             return;         }         if(x<0 || x>size){          System.out.println("invalid index");          return;         }         if(x==size){             Node tail=head;             Node temp=new Node(val);             for(int i=1; i<...

Insert the element at Start in Linked List in java.

class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtStart(int val){       Node temp = new Node(val);             if(head==null)          head=tail=temp;         else         {             temp.next=head;             head=temp;         }         size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }       ...

Insert the element at end of Linked List in java.

program- > class Node{     int val;     Node next;     Node(int val){         this.val=val;     } } class Sll{     Node head;     Node tail;     int size;     void insertAtEnd(int val){     Node temp = new Node(val);     if(head==null) head=tail=temp;     else       {         tail.next=temp;         tail=temp;        }        size++;     }     void display(){         Node temp=head;         while(temp!=null) {             System.out.print(temp.val+" ");             temp=temp.next;         }         System.out.println();     }     void size(){         System.out.print...

Linked list creation and printing in java.

class Node {     int val;     Node next;     Node(int val) {         this.val=val;     } } public class Main {     public static void Print(Node head){         Node temp=head;         while(temp!=null){            System.out.println(temp.val);            temp=temp.next;        }     }     public static void PrintRecursive(Node head){         if(head==null) return;         System.out.println(head.val);         PrintRecursive(head.next);     } public static void main(String[] args) {    Node a = new Node(1);    Node b = new Node(2);    Node c = new Node(3);         Node d = new Node(4);        Node e = new Node(5);     ...

Linked list in java.

code link - >       https://onlinegdb.com/Le8lXvGPI

Program to find the product of all elements of array in java.

■ Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/9G4Eojj72NFe5

Program to find sum of all elements of array in java.

■》 Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/9DMO7SjpP0z12

Array Question in java.

// Question # -> an array of marks of students, if the mark of any student is less than 35 print its roll number. [roll number here refers to the index of the array.] ■》 Code link -> click here                👇👇👇 https://www.programiz.com/online-compiler/9jRTwUPXFvTQn

Number bridge pattern 2 in java.

Image
 ■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/61UQBqouXRxOn

Capital alphabets bridge pattern in java.

Image
■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/6DMO4k2pj0Uwc

Hollow square pattern 2 in java.

Image
 ■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/7pga9s82cYdCu

V shape pattern in java.

Image
■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/0CcvFSNqkpEvY =====================================

Palindrome Pyramid with capital alphabets Pattern 2 in java.

Image
■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/8yAueb903djN4

Pyramid with capital alphabets Pattern 1 in java.

Image
■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/2NwkgWQxJB7NO

Pyramid with numbers pattern 2 in java.

Image
■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/44XG2QDuJwNmy

Pattern in java.

Image
 ■ 》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/6Yueiu18gtraQ

Rectangle pattern 2 in java.

Image
■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/3I9hMFtUVbvdT

Half pyramid ■ star triangle with reverse column numbers pattern in java.

Image
 ■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/8xP5m97wbrjmM

Inverted pyramid with row numbers pattern in java.

Image
■》Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/6G4EDj7XMNBzB

Number spiral pattern 2 in java.

Image
■》 Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/1zoZiOD3z2SDw

Number spiral pattern 1 in java.

Image
■》 Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/8NwkDmuDiBPvt

Diamond pattern 2 in java.

Image
■》 Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/2DMOAV42g0Un6

Number bridge pattern in java.

Image
■》 Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/5wQNMjI6OThy6

Star bridge pattern in java.

Image
■》 Code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/265m3hch3oQJd

Palindrome pyramid pattern in java.

Image
■》 Code  link  ->   click 👇👇👇 https://www.programiz.com/online-compiler/3dsHQLi02h2jc

180 degree rotated half pyramid ■ star triangle with numbers pattern 2 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/5m6UGYXA4zSiS

180 degree rotated half pyramid ■ star triangle with small alphabets pattern pattern in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/8RZjf7MtbCTR9

180 degree rotated half pyramid ■ star triangle with capital alphabets pattern in java.

Image
 ■》 code link -> click 👇👇👇 https://www.programiz.com/online-compiler/65x6XffBDV3ZB

180 degree rotated Half pyramid ■ star triangle with numbers pattern 1 in java.

Image
 ■》 code link -> click 👇👇👇 https://www.programiz.com/online-compiler/1ODlmTuxNKjCx

Cross star pattern in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/4Um1EXQToZoHo

Star plus pattern in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/9lOrU5jl9XgMB

Half pyramid ■ star triangle with odd numbers pattern in java.

Image
■》 code link -> click 👇👇👇👇                          Method -1 https://www.programiz.com/online-compiler/00nKo9IwNUdrP                           Method -2 https://www.programiz.com/online-compiler/2tH8qTZllMcqZ

Flipped half pyramid ■star triangle with capital alphabets Pattern 2 in java

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/3MLDNpGzAnFHx

Flipped half pyramid ■ star triangle with small alphabets pattern 2 in java.

Image
 ■》code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/3xP5KgWhfrcoL

Flipped half pyramid ■ star triangle with small alphabets Pattern 1 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online- compiler/2pgadxKU7YmDY

Flipped half pyramid ■star triangle with capital alphabets Pattern 1 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/3NwkvtnrtBsNY

Flipped half pyramid ■ star triangle with numbers pattern 2 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/7CcvyblRIpcoH

Flipped half pyramid ■ star triangle with numbers pattern 1 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/4dsHiKQ3mhntQ

Flipped half pyramid ■ flipped star triangle pattern in java.

Image
■》 code link -> click 👇👇👇👇                         Method -1 https://www.programiz.com/online-compiler/8pgadbyA3Ym8k                         Method -2 https://www.programiz.com/online-compiler/2I9h70mCrb5eU

Half pyramid ■ star triangle mixture of numbers and alphabets pattern in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/7LhMxPDGdSCTg

Half pyramid ■ star triangle with small alphabets pattern 2 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/0zoZ9O8rm2asR

Half pyramid ■ star triangle with small alphabets pattern 1 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/3NwkvRW5iBXrF

Half pyramid ■ star triangle with capital alphabets pattern 2 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/9hILPJLl4qjhx

Half pyramid ■ star triangle with capital alphabets pattern 1 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/7dsHi3eNWhxcS

Half pyramid ■ star triangle with numbers pattern 2 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/4iJbDtX2yPJv0

Half pyramid ■ star triangle with numbers pattern 1 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/35x6X77CpViuc

Solid square with small alphabets Pattern 2 in java.

Image
■》 code link -> click 👇👇👇👇 https://www.programiz.com/online-compiler/8I9h7vjFdb0Xd

Solid square with small alphabets Pattern 1 in java.

Image
 ■》 code link -> click 👇👇👇 https://www.programiz.com/online-compiler/1gfpsGn3Nug56

Solid square with capital alphabets Pattern 2 in java.

Image
■》 code link -> click.                  👇👇👇👇 https://www.programiz.com/online-compiler/6HdtbB76cLdmC