In this program you will read a file specifying a directed graph G as a list of edges. Each edge u →v is listed on one line as u v. The input file simply lists the edges in arbitrary order as pairs of vertices, with each edge on a separate line. The vertices are numbered in order from 1 to the total number of vertices. The program outputs the out-degree sequence for GSCC in increasing order.
For example for the input below:
2 1
3 2
1 3
1 5
3 4
4 5
6 7
5 6
7 4
3 11
2 8
8 9
10 8
9 10
9 4
9 7
10 11
7 11
6 11
the corresponding output is:
0 1 2 3
You should be able to implement this program to run in linear time (time proportional to the total number of vertices plus the total number of edges in the input graph)
Use Kosaraju's Algorithm to find the SCC
Please code this in C
In: Computer Science
This assignment requires you to use at least one loop and an array. You can refer to our book and any programs you have written so far. Make sure that your work is your own.
Write a comment at the beginning of your program with your name and your birthday (month and day, does not need to include year). For example: John Doe, May 23
Create an array that will store whole numbers. The size of the array should be ten more than the month number of your birthday. Continuing the example, for a birthday in May, the array will be of size 15 since May is the fifth month and 5 + 10 = 15.
Then let the user enter each value to store in the array. Perform input validation that the user enters numbers between 1 and the day of the month that is your birthday. (That is, a value is invalid if is less than 1. Similarly, a value is invalid if it is greater than the day of the month that is your birthday.) Continuing the example, for a birthday on the 23 of the month, the valid values the user can enter are 1 through 23
Go through the array and collapse the array into a single representative number as follows:
i. First replace every three adjacent integers with the sum of the two numbers. For example, if the first three elements of the array are 1, 2, and 3, they become the single value of 6. For example [1, 2, 8, 9, 4, 13, 7, 1, 9, 10, 5] becomes [11, 26, 17, 15]
ii. Go through the new array and modify any number that is larger than 12 to be the difference between it and 12. (You can use either subtraction or modulus for this.) Continuing the example, [11, 26, 17, 15] becomes [11, 14, 5, 3]
Then iteratively continue collapsing the array until you have a single representative integer. Continuing the example: Add adjacent three integers in [11, 14, 5, 3] to get [30, 3] Then change it to become [18, 3] Add adjacent three integers in [18, 3] to get the single value of 21 which is modified to be 9 and the result is displayed to the user.
Some tips: Try this process with more than 1 array as input to make sure it really works! If you are finding this confusing or difficult, begin with getting input from user and performing the first iteration of adding adjacent pairs of integers.
Programming code should be written in Java Language thank you
In: Computer Science
***PLEASE READ CAREFULLY. IF NOT ANSWERED IN FLOWGORITHM PLEASE DON'T ANSWER***
Can you please create a flowgorithm chart for the problem below. Also, provide pseudocode as well. Please do not answer if you cannot put into a flowgorithm chart. Pseudocode needed as well. Thank you!
Design the logic for a program that outputs every number from 1 through 15 along with its value times 10 and times 100. Make the output look like below:
Number is 1 Times 10 is 10 Times 100 is 100
To accomplish the output above “Number is “ & variable “ Times 10 is “ & variable and so on. Leave a space right after the double quote and before the double quote so the variable’s answer doesn’t run right into the descriptive text.
In: Computer Science
LANGUAGE IS JAVA
Part One
Part Two
Both Parts
Samples:
John Public;Dinner;29.95;6/7/2014 Jane Public;Conference;499.00;8/9/2014 Abby Lawrence;Dinner;23.45;10/10/2014
John Public;Dinner;29.95;6/7/2014 Abby Lawrence;Dinner;23.45;10/10/2014
Jane Public;Conference;499.0;8/9/2014
Grading Criteria
In: Computer Science
Encoding a message starts with assigning each letter of the
alphabet with a positive integer using a
specific pattern, thus rewriting the original message as a list of
numbers instead of words. Decoding
a message is the process that “undoes” the encoding process. Assume
that the table below was
used to encode an important secret message.
A – 1 F – 6 K – 11 P – 16 U – 21 Z – 26
B – 2 G – 7 L – 12 Q – 17 V – 22 Blank - 27
C – 3 H – 8 M – 13 R – 18 W – 23
D – 4 I – 9 N – 14 S – 19 X – 24
E – 5 J – 10 O – 15 T – 20 Y – 25
You intercepted the following encoded message from Boris and
Natasha.
25 19 19 30 41 17 15 26 27 41 15 28 18 41 18 29 41 34 22 19 41 27
15 34 22
You do not know the encoding or decoding function, but you know
this message consists of 6 words.
Using the encoding system described above, answer the following
questions.
Analysis
1. From previous work with Boris and Natasha, you know that their
encoding and decoding functions
are always linear and have 1 as the coefficient of x. Write the
general form of the linear function
that could be used to decode the message.
Inquiry and Evaluation
2. What strategy would you use to decode the message? Write your
answer in complete sentences
using proper grammar, appropriate capitalization and correct
spelling.
Evaluation
3. Write the decoding function. Use proper function notation.
Synthesis
4. What is the decoded message?
5. Why is it necessary for the encoding function to be
one-to-one? Give a clear, thorough,
explanation specific to this assignment. Use complete sentences,
correct spelling, appropriate
capitalization, and proper grammar.
In: Computer Science
To come up with a problem definition, write up some sample
questions you would ask the president of Java Airlines to better
help what they would like their software to do. Be Creative in your
questions!
Write up a mock Problem Definition Statement to summarize what you
think the Java Airline software should be.
Attention to detail will earn full marks on this assignment.
In: Computer Science
1.Explain what REST is and what are the REST variables
2. Explain how the Loc8r application can be modified to confirm with API architecture?
In: Computer Science
Unix command lines.
A) Assume that your current working directory is NOT the same as your home directory. Print all file and subdirectory names of your home directory into a file named file2.
B) Copy the text from line 11 to line 20 of a given file input.txt and append the copied text at the end of the file output.txt. (Assume that the file input.txt contains more than 20 lines of text contents)
C) Count and display the total number of words in ALL files in the current working directory whose name end with “.txt”
D) Count the number of lines where the word “foo” appears in a given file bar.txt
In: Computer Science
You accepted a position at the company to lead a team of 3 multi-media developers (excluding yourself). This team will be responsible for graphic design, animations, and promotional material. Your role is to manage the team members, their hardware and software needs, and projects. Your employer asks you to assess the HARDWARE needs for the team and propose a computer configuration that would meet the functions of the team yet the least expensive.
Based on the information that you were given above (and not more), do your research (internet, friends, companies, etc…) and answer the following questions (briefly but at least close to 200 words):
What are the TOP two (2) MOST important computer parts you would need to consider for the team computers and why? (RAM, CPU, Graphics Card, Hard Drive, etc...) For these computer parts that you identified in the previous question, what general specifications would you recommend and why?
In: Computer Science
** Pascal ** Write a simple program in Pascal with these specifications:
1. Calculates real root of number entered by user (if root happens to be a complex number, print message "The root is complex").
2. The program keeps asking for input, user can input a key to terminate program. (e.g: Press 1 to enter calculator, Press any other key to exit calculator).
In: Computer Science
The devices designed for the purpose of addressing security in the network generate a number of logs during the continuous monitoring of the network. Discuss in detail the different types of logs created and how the security professional can use this information for analyzing security in the network.
In: Computer Science
C Programming
Illustrate the stack and the heap allocation. Specify what each variable value holds and where different references are pointing to.
char[] class = {'C','O','M','P','1','2','2'"};
#define int n = 4;
long long fibb(long long a, long long b, int n)
{
return (--n>0)?(fibb(b, a+b, n)):(a);
}
int main()
{
fib(3);
//illustrate what memory looks like at this point
return 0;
}
In: Computer Science
Create a class called Student which stores
• the name of the student
• the grade of the student
• Write a main method that asks the user for the name of the input file and the name of the output file. Main should open the input file for reading . It should read in the first and last name of each student into the Student’s name field. It should read the grade into the grade field.
• Calculate the average of all students’ grades.
• Open the output file, for writing, and print all the students’ names on one line and the average on the next line.
• Average should only have 1 digit after the decimal
• “Average” should be left justified in a field of 15 characters. The average # should be right justified in a field of 10 spaces
Sample input:
Minnie Mouse 98.7
Bob Builder 65.8
Mickey Mouse 95.1
Popeye SailorMan 78.6
Output:
Minnie Mouse, Bob Builder, Mickey Mouse, Popeye SailorMan
Average: 84.5
How can I fix my code to get the same output
public class Student {
public static void main(String[] args)throws IOException{
Scanner k=new Scanner(System.in);
String name;
float grade;
float Average=(float) 0.0;
float sum=(float) 0.0;
System.out.println("Enter input file name:");
String input=k.nextLine();
System.out.println("Enter output file name:");
String output=k.nextLine();
PrintWriter pw = new PrintWriter("students.txt");
pw.print("Minnie Mouse 98.7\nBob Builder 65.8\nMickey Mouse
95.1\nPopeye SailorMan 78.6\n");
pw.close();
PrintWriter pw2 = new PrintWriter("students2.txt");
pw2.print("Donald Duck 77.77\nTweety Bird 55.555\nCharlie Brown
95.231\n");
pw2.close();
/* End of creating the input file */
while(k.hasNext())
{
name=k.next();
grade=k.nextFloat();
Average+=grade;
sum++;
System.out.printf("name, ", name);
}
grade=Average/sum;
System.out.printf("\n%-15s%10.1f","Average", grade);
/* test output file */
Scanner testOutput = new Scanner(new File("average.txt"));
while(testOutput.hasNext())
System.out.println(testOutput.nextLine());
/* end of test output file */
}
}
In: Computer Science
C++ (data structure using c++). please send me copyable file.
Write a program and test a program that translates the following Bubble Sort algorithm to a bubblesort function. The function's prototype is,
void bubblesort(int a[], int size);
Bubble Sort
The inner loop moves the largest element in the unsorted part of the array to the last position of the unsorted part of the array; the outer loop moves the last position of the unsorted part of the array.
The Bubble sort exchanges elements with adjacent elements as it moves the largest element in the unsorted part of the array to its correct position in the sorted part of the array. Once at its correct position an element never moves again. An element may change its position many times before moving to its correct position.
BubbleSort(A)
for outer := A.length - 1 to 1
for inner := 0 to outer –1
if A[inner] > A[inner + 1] then
temp := A[inner]
A[inner] := A[inner + 1]
A[inner + 1 := temp
end if
end for
end for
end BubbleSort
program:
#include <ctime>
#include <iomanip>
#include <iostream>
#include <random>
#include <string>
using namespace std;
bool fill(int a[], int size,
uniform_int_distribution<int>& u,
default_random_engine& e)
{
if (size < 1)
return false;
for (int i = 0; i < size; ++i)
a[i] = u(e);
return true;
}
void show(int a[], int size)
{
for (int i = 0; i < size; ++i)
cout << a[i] << ' ';
}
void bubblesort(int a[], int size)
{
}
int main()
{
const int size = 8;
default_random_engine e;
uniform_int_distribution<int> u(10, 99);
int a1d[size];
fill(a1d, size, u, e);
show(a1d, size); cout << endl;
bubblesort(a1d, size);
show(a1d, size);
cout << endl;
system("pause");
return 0;
}
In: Computer Science
Write a program and test a program that translates the following Bubble Sort algorithm to a bubblesort function. The function's prototype is,
void bubblesort(int a[], int size);
Bubble Sort
The inner loop moves the largest element in the unsorted part of the array to the last position of the unsorted part of the array; the outer loop moves the last position of the unsorted part of the array.
The Bubble sort exchanges elements with adjacent elements as it moves the largest element in the unsorted part of the array to its correct position in the sorted part of the array. Once at its correct position an element never moves again. An element may change its position many times before moving to its correct position.
BubbleSort(A)
for outer := A.length - 1 to 1
for inner := 0 to outer –1
if A[inner] > A[inner + 1] then
temp := A[inner]
A[inner] := A[inner + 1]
A[inner + 1 := temp
end if
end for
end for
end BubbleSort
use this code
#include <ctime>
#include <iomanip>
#include <iostream>
#include <random>
#include <string>
using namespace std;
bool fill(int a[], int size,
uniform_int_distribution<int>& u,
default_random_engine& e)
{
if (size < 1)
return false;
for (int i = 0; i < size; ++i)
a[i] = u(e);
return true;
}
void show(int a[], int size)
{
for (int i = 0; i < size; ++i)
cout << a[i] << ' ';
}
void bubblesort(int a[], int size)
{
}
int main()
{
const int size = 8;
default_random_engine e;
uniform_int_distribution<int> u(10, 99);
int a1d[size];
fill(a1d, size, u, e);
show(a1d, size); cout << endl;
bubblesort(a1d, size);
show(a1d, size);
cout << endl;
system("pause");
return 0;
}
In: Computer Science