Skip to content
This repository was archived by the owner on Oct 2, 2020. It is now read-only.

added sub Array in java #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions Algorithms/Bubblesort/Kotlin/BubbleSort.kt

This file was deleted.

18 changes: 0 additions & 18 deletions Algorithms/Bubblesort/kotlin/BubbleSort.kt

This file was deleted.

34 changes: 34 additions & 0 deletions Algorithms/Recursion/FindSubArray/FindSubArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.util.*;
class FindSubArray
{
static void subArray(int []arr, int start, int end)
{
if (end == arr.length)
return;
else if (start > end)
subArray(arr, 0, end + 1);
else
{
System.out.print("(");
for (int i = start; i < end; i++){
System.out.print(arr[i]+", ");
}
System.out.println(arr[end]+")");
subArray(arr, start + 1, end);
}
return;
}
public static void main(String args[])
{
int n;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter size of array: ");
n = scanner.nextInt();
int arr[] = new int[n];
System.out.println("Enter Elements of Array: ");
for(int i=0; i<n; i++){
arr[i] = scanner.nextInt();
}
subArray(arr, 0, 0);
}
}