Line: 1 to 1  

 
Line: 6 to 6  
Lab 6  TallyingDue: March 28, 11:55pm  
Changed:  
< <  Moodle Link  
> >  Moodle Link  
Instructions

Line: 1 to 1  

 
Changed:  
< <  Due: Oct 25, 11:55pm  
> >  Due: March 28, 11:55pm  
Changed:  
< <  Moodle Link  
> >  Moodle Link  
Instructions

Line: 1 to 1  

 
Line: 6 to 6  
Lab 6  TallyingDue: Oct 25, 11:55pm  
Changed:  
< <  Moodle Link  
> >  Moodle Link  
Instructions
 
Line: 15 to 14  
Grading Table
 
Changed:  
< < 
 
> > 
 
 
Changed:  
< < 
 
> > 
 
Problem  
Line: 42 to 43  
 
Added:  
> > 
 
Turn InRuns of the following: 
Line: 1 to 1  

 
Added:  
> >  
 
Changed:  
< <  Due: Oct 20, 11:55pm  
> >  Due: Oct 25, 11:55pm  
Instructions  
Line: 64 to 67  
 
Changed:  
< < 
 
> > 
 

Line: 1 to 1  

 
Changed:  
< <  Lab 6  
> > 
 
Due: Oct 20, 11:55pm  
Added:  
> >  
Instructions
 
Line: 59 to 64  
 
Added:  
> > 

Line: 1 to 1  

Lab 6Due: Oct 20, 11:55pm  
Line: 11 to 11  
 
Changed:  
< < 
 
> > 
 
ProblemWrite a program that reads in a list of integers into an array with base type int . The program will require the user to input the numbers. You may assume that there are fewer than 50 entries in the array. If the user specifies more than 50, you should provide an error message, and ask them to reenter. The output is to be a twocolumn list. The first column is a list of the distinct array elements; the second column is the count of the number of occurrences of that element. The list should be sorted on entries in the first column, smallest to largest.  
Changed:  
< <  For example, for the following input  
> >  For example, for the following input:  
Input the number of entries: 16 Enter the numbers:12 3 12 4 1 1 12 1 1 1 2 3 4 2 3 12 Number Count  
Line: 54 to 54  
Show how the program responds to bad input with too many entries (>50) selected, and zero numbers selected.  
Changed:  
< <  Solutions  
> >  Solutions  

Line: 1 to 1  

Lab 6Due: Oct 20, 11:55pmInstructions  
Deleted:  
< < 
 
 
Changed:  
< <  Grading  
> > 
Grading Table
 
Changed:  
< < 
Problem 1  
> >  Problem  
Changed:  
< <  Write a program that reads in a list of integers into an array with base type int . The program will require the user to input the numbers. You may assume that there are fewer than 50 entries in the array. If the user specifies more than 50, you should provide an error meaage, and ask them to reenter. The output is to be a twocolumn list. The first column is a list of the distinct array elements; the second column is the count of the number of occurrences of each element. The list should be sorted on entries in the first column, largest to smallest.  
> >  Write a program that reads in a list of integers into an array with base type int . The program will require the user to input the numbers. You may assume that there are fewer than 50 entries in the array. If the user specifies more than 50, you should provide an error message, and ask them to reenter. The output is to be a twocolumn list. The first column is a list of the distinct array elements; the second column is the count of the number of occurrences of that element. The list should be sorted on entries in the first column, smallest to largest.  
For example, for the following input
Input the number of entries: 16 Enter the numbers: 12 3 12 4 1 1 12 1 1 1 2 3 4 2 3 12  
Added:  
> >  Number Count 12 4 1 1 1 4 2 2 3 3 4 2  
Changed:  
< <  the output should be
HintIt is MUCH easier to count the number of occurances if you sort the numbers first, then do the counting.  
> >  Hints
 
Turn In  
Changed:  
< <  A run with a 10 numbers, and a run 30 numbera
Problem 2Pattern Matching: Write a program that looks for a pattern of integers in an array of integers. The program first asks the user to input up to 100 numbers greater than or equal to zero. The user terminates the input with a negative number or sentinal. The program automatically moves to the next step after 100 numbers has been entered. The program then enters a loop, and asks the users to enter a sequence of up to 10 numbers. As before, they enter numbers until either a negative number is entered, or they have entered 10 numbers. This array will be called the pattern. The program then searches the larger array for a subsequence of numbers that matches the pattern. It will continue to search until it finds all instances of that pattern, counting the matches. (Note that for this exercise patterns cannot overlap, e.g. when you find a pattern, start searching for then next only AFTER the previous pattern. The program will then report the number of matching, and then ask for another pattern to be entered. If the user enters a negative number when as the first number in a pattern, the pattern is empty, and the program terminates. If the user enters a pattern that is longer then the search array, give the user an error. Example:
Enter up to 100 integers: 1 4 3 6 8 5 12 5 6 8 5 2 9 3 1 4 3 6 6 8 5 1 Enter a pattern: 2 1 Matches:1 Pattern 2 Enter a pattern: 6 8 5 1 Matches:3 Pattern 6 8 5 Enter a pattern: 1 Good bye!  
> >  Runs of the following:
Trials#1Input the number of entries:40 Enter the numbers:3 5 4 5 7 6 8 2 3 2 3 1 2 1 1 1 5 4 5 6 4 6 4 6 4 2 5 4 6 2 7 6 7 4 8 5 7 8 9 2  
Added:  
> >  #2Input the number of entries:20 Enter the numbers:23 54 23 12 54 34 54 34 14 0 17 54 12 0 0 54 34 0 12 45 #3Input the number of entries:50 Enter the numbers:1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2  
Changed:  
< <  </pre>  
> >  #4  
Changed:  
< <  Turn in:  
> >  Show how the program responds to bad input with too many entries (>50) selected, and zero numbers selected.  
Changed:  
< <  1. A search in array "3 6 4 7 8 4 6 2 4 10 4 8 6 5 4 6 4 6 8 6 5 6 4 2 7 9 6 5 6 5 6 5 5 1 2 1 3 6 4 7 8 6 8 6"  
> >  Solutions  
Changed:  
< < 
 
> >  
Deleted:  
< < 
 
\ No newline at end of file  
Added:  
> > 
Line: 1 to 1  

Lab 6  
Changed:  
< <  Due: Oct 21, 11:55pm  
> >  Due: Oct 20, 11:55pm  
Instructions

Line: 1 to 1  

Lab 6Due: Oct 21, 11:55pmInstructions  
Changed:  
< < 
 
> > 
 
Grading  
Line: 14 to 14  
 
Changed:  
< <  Problems  
> >  Problem 1  
Changed:  
< <  1. Write a program that reads in a list of integers into an array with base type int . The program will require the user to input the numbers. You may assume that there are fewer than 50 entries in the array. If the user specifies more than 50, you should provide an error meaage, and ask them to reenter. The output is to be a twocolumn list. The first column is a list of the distinct array elements; the second column is the count of the number of occurrences of each element. The list should be sorted on entries in the first column, largest to smallest.  
> >  Write a program that reads in a list of integers into an array with base type int . The program will require the user to input the numbers. You may assume that there are fewer than 50 entries in the array. If the user specifies more than 50, you should provide an error meaage, and ask them to reenter. The output is to be a twocolumn list. The first column is a list of the distinct array elements; the second column is the count of the number of occurrences of each element. The list should be sorted on entries in the first column, largest to smallest.  
For example, for the following input  
Line: 35 to 35  
Hint  
Changed:  
< <  It is MUCH easier to make the number of occurances if you sort the numbers first, then do the counting.  
> >  It is MUCH easier to count the number of occurances if you sort the numbers first, then do the counting.
Turn In  
Changed:  
< <  Turn in: A run with a 10 numbers, and a run 30 numbera  
> >  A run with a 10 numbers, and a run 30 numbera  
 
Changed:  
< <  2. Pattern Matching: Write a program that looks for a pattern of integers in an array of integers. The program first asks the user to input up to 100 numbers greater than or equal to zero. The user terminates the input with a negative number or sentinal. The program automatically moves to the next step after 100 numbers has been entered.  
> >  Problem 2Pattern Matching: Write a program that looks for a pattern of integers in an array of integers. The program first asks the user to input up to 100 numbers greater than or equal to zero. The user terminates the input with a negative number or sentinal. The program automatically moves to the next step after 100 numbers has been entered.  
The program then enters a loop, and asks the users to enter a sequence of up to 10 numbers. As before, they enter numbers until either a negative number is entered, or they have entered 10 numbers. This array will be called the pattern. 
Line: 1 to 1  

Added:  
> > 
Lab 6Due: Oct 21, 11:55pmInstructions
Grading
Problems
1. Write a program that reads in a list of integers into an array with base type For example, for the following input
Input the number of entries: 16 Enter the numbers: 12 3 12 4 1 1 12 1 1 1 2 3 4 2 3 12 the output should be
HintIt is MUCH easier to make the number of occurances if you sort the numbers first, then do the counting. Turn in: A run with a 10 numbers, and a run 30 numbera
2. Pattern Matching: Write a program that looks for a pattern of integers in an array of integers. The program first asks the user to input up to 100 numbers greater than or equal to zero. The user terminates the input with a negative number or sentinal. The program automatically moves to the next step after 100 numbers has been entered. The program then enters a loop, and asks the users to enter a sequence of up to 10 numbers. As before, they enter numbers until either a negative number is entered, or they have entered 10 numbers. This array will be called the pattern. The program then searches the larger array for a subsequence of numbers that matches the pattern. It will continue to search until it finds all instances of that pattern, counting the matches. (Note that for this exercise patterns cannot overlap, e.g. when you find a pattern, start searching for then next only AFTER the previous pattern. The program will then report the number of matching, and then ask for another pattern to be entered. If the user enters a negative number when as the first number in a pattern, the pattern is empty, and the program terminates. If the user enters a pattern that is longer then the search array, give the user an error. Example: Enter up to 100 integers: 1 4 3 6 8 5 12 5 6 8 5 2 9 3 1 4 3 6 6 8 5 1 Enter a pattern: 2 1 Matches:1 Pattern 2 Enter a pattern: 6 8 5 1 Matches:3 Pattern 6 8 5 Enter a pattern: 1 Good bye! </pre> Turn in: 1. A search in array "3 6 4 7 8 4 6 2 4 10 4 8 6 5 4 6 4 6 8 6 5 6 4 2 7 9 6 5 6 5 6 5 5 1 2 1 3 6 4 7 8 6 8 6"
