Skip to content

Commit

Permalink
Added runtime input (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
somya-kapoor authored and GOVINDDIXIT committed May 13, 2019
1 parent ddbd9f9 commit cb50051
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
7 changes: 5 additions & 2 deletions FCFS_Scheduling/FCFS_Scheduling.cpp
Expand Up @@ -40,8 +40,11 @@ void solve(lint no_of_process, lint burst_time[]) {
}

int main() {
lint no_of_process = 3;
lint burst_time[] = {5, 7, 3};
lint no_of_process;
cin >> no_of_process;
lint burst_time[no_of_process];
for (int i = 0; i < no_of_process; i++)
cin >> burst_time[i];
solve(no_of_process, burst_time);
}

Expand Down
12 changes: 9 additions & 3 deletions FCFS_Scheduling/FCFS_Scheduling.go
Expand Up @@ -44,9 +44,15 @@ func solve(no_of_process int, burst_time []int) {
}

func main() {
var no_of_process int = 3
var burst_time []int = []int{5, 7, 3}
solve(no_of_process, burst_time)
var no_of_process int
fmt.Scan(&no_of_process)
burst_time := []int{}
for i := 0; i < no_of_process; i++ {
var x int
fmt.Scan(&x)
burst_time = append(burst_time, x)
}
solve(no_of_process, burst_time)
}

/*
Expand Down
13 changes: 10 additions & 3 deletions FCFS_Scheduling/FCFS_Scheduling.java
Expand Up @@ -14,6 +14,9 @@
Given the Burst time, We need to find Waiting time and Turnaround time of each process.
*/

import java.util.Scanner;
import java.util.*;

class FCFS {

public static void solve(int no_of_process, int burst_time[]) {
Expand All @@ -39,11 +42,15 @@ public static void solve(int no_of_process, int burst_time[]) {
}

public static void main(String args[]) {
int no_of_process = 3;
int burst_time[] = {5, 7, 3};
Scanner sc = new Scanner(System.in);
int no_of_process = sc.nextInt();
int burst_time[] = new int[no_of_process];
for(int i = 0; i < no_of_process; i++)
{
burst_time[i] = sc.nextInt();
}
solve(no_of_process, burst_time);
}

}

/*
Expand Down
7 changes: 5 additions & 2 deletions FCFS_Scheduling/FCFS_Scheduling.py
Expand Up @@ -32,8 +32,11 @@ def solve(no_of_process, burst_time) :
print("Process " , i + 1 , " --> (B.T) : " , burst_time[i] , " (W.T.) : " ,
wait_time[i] , " (T.A.T) : " , turnaround_time[i])

no_of_process = 3
burst_time = [5, 7, 3]
no_of_process = int(input())
burst_time = []
for i in range(no_of_process):
x = int(input())
burst_time.append(x)
solve(no_of_process, burst_time)

'''
Expand Down
12 changes: 8 additions & 4 deletions Sleep_Sort/Sleep_Sort.c
Expand Up @@ -21,15 +21,19 @@ void sleepSort(int arr[], int n)

int main()
{
int arr[] = {12, 23, 42, 3};
int n = sizeof(arr) / sizeof(arr[0]);

cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
sleepSort (arr, n);

return 0;
}

//output
/*
INPUT:
n = 4
arr[] = {12, 42, 23, 3}
OUTPUT:
3 12 23 42
*/

0 comments on commit cb50051

Please sign in to comment.