Introduction To Computer Science and Programming
CSc 10000
Fall 2003
 

News
Syllabus
Assignments


Due

Assignment

12/03/03

  1. One pass min & max
    • Read from standard input (keyboard) number of integers that will be given to program
    • Read specified number of integers
    • Find minimum and maximum among these numbers, do it by going over array only once
  2. Pairwise sum
    • Read from standard input (keyboard) an integer number, let's call it N
    • Read N integers
    • Read N integers more
    • Find pairwise sums and print them out
    • For example, if I enter 3 for N, then 1,10,100 and 5,6,7, your program should sum 1 and 5, 10 and 6, 100 and 7 so output should be 6,16,107
  3. Binary search
    • Read from standard input (keyboard) an integer number, let's call it N
    • Read N integers, they will be given in non-decreasing order
    • Read one more integer K
    • Search for K among N integers that were entered using binary search algorithm described in Chapter 4
    • Report if K was found or not
  4. Insertion sort
    • Read from standard input (keyboard) an integer number, let's call it N
    • Read N integers
    • Sort them using insertion sort described in Chapter 4
    • Print out the resulting ordered array

11/24/03

    • Read from standard input (keyboard) number of integers that will be given to program
    • Read specified number of integers
    • Print entered integers to standard output
  1. Like problem 1 but instead of negative numbers output word "negative".
  2. Like problem 1 but instead of negative numbers output their absolute value. So instead of -5 program should print 5.
  3. Like problem 1 but first output only positive numbers and zeros (if they occur in the input) then output negative numbers (that were in the input).
  4. Like problem 1 but output only sum of entered numbers.
Solutions: 1, 2, 3, 4, 5.