Difference between revisions of "Problem of the Week"
(Created page with "This page lists the "problems of the week" - extra programming problems meant to help people practice their programming skills. =About= These will be at a variety of differ...") |
|||
Line 13: | Line 13: | ||
==Numbers== | ==Numbers== | ||
'''factor''' 5/20/2020 - read an integer from standard input (keyboard), output its prime factorization. | '''factor''' 5/20/2020 - read an integer from standard input (keyboard), output its prime factorization. | ||
+ | Example input: 12 | ||
+ | Example output: 2 * 2 * 3 | ||
+ | Example input: 5 | ||
+ | Example output: 5 | ||
'''primes''' 5/20/2020 - read an integer from standard input, output all prime numbers <= that number. | '''primes''' 5/20/2020 - read an integer from standard input, output all prime numbers <= that number. | ||
+ | Example input: 19 | ||
+ | Example output: 2 3 5 7 11 13 19 | ||
'''stats''' 5/20/2020 - read an integer n and then n integers from standard input, output the min, max, mean. | '''stats''' 5/20/2020 - read an integer n and then n integers from standard input, output the min, max, mean. | ||
+ | Example input: 5 7 3 2 10 -5 | ||
+ | Example output: -5 10 3.4 | ||
=Data Structures and Algorithms= | =Data Structures and Algorithms= | ||
Line 26: | Line 34: | ||
==Lists== | ==Lists== | ||
− | '''rpn''' 5/20/2020 - evaluate the command line arguments as an RPN expression. Note that you will need to keep a stack (linked list) of the values (since this is how RPN is evaluated). | + | '''rpn''' 5/20/2020 - evaluate the command line integer arguments as an RPN expression. Note that you will need to keep a stack (linked list) of the values (since this is how RPN is evaluated). |
+ | Example input (command-line args): 1 2 3 * + | ||
+ | Example output: 7 | ||
+ | Example input: 3 5 7 - / | ||
+ | Example output: -1.5 | ||
=Data Science= | =Data Science= |
Revision as of 01:29, 21 May 2020
This page lists the "problems of the week" - extra programming problems meant to help people practice their programming skills.
Contents
About
These will be at a variety of different levels. Some support is provided in the CS Online Lab team in Microsoft Teams. You can go to the team, go to the Problem of the Week channel, and fire away your questions.
Note that many of these problems can be solved in any programming language. The CS Online Lab will support assistance in Python, C, C++, and R. Some problems may be easier to implement in some languages than others.
Problems are listed in "reverse chronological order" within each section/subsection (new problems are added to the top of the section). A date of posting is listed for each problem.
Note that some "classic" programming problems are listed. You should work to solve these on your own, not by simply looking up the solutions online. You learn and improve your skills by making the solutions yourself.
Basic Programming
Numbers
factor 5/20/2020 - read an integer from standard input (keyboard), output its prime factorization. Example input: 12 Example output: 2 * 2 * 3 Example input: 5 Example output: 5
primes 5/20/2020 - read an integer from standard input, output all prime numbers <= that number. Example input: 19 Example output: 2 3 5 7 11 13 19
stats 5/20/2020 - read an integer n and then n integers from standard input, output the min, max, mean. Example input: 5 7 3 2 10 -5 Example output: -5 10 3.4
Data Structures and Algorithms
Sorting
sorts 5/20/2020 - first command-line argument is either bubble, insertion, selection. Read from standard input until EOF, output the number of steps to sort the numbers. If second command-line argument is "verbose", also print the numbers in sorted order.
Trees
binaryTree 5/20/2020 - read integers from standard input until EOF, output the number of steps to build a binary tree out of the numbers. If second command-line argument is "verbose", also print the tree.
Lists
rpn 5/20/2020 - evaluate the command line integer arguments as an RPN expression. Note that you will need to keep a stack (linked list) of the values (since this is how RPN is evaluated). Example input (command-line args): 1 2 3 * + Example output: 7 Example input: 3 5 7 - / Example output: -1.5