Assignment 3

Do the following questions in C++.

  1. Write a function that returns the number of zeros in a given simple list of numbers.
  2. Write a function that takes a simple list of numbers as a parameter and returns a list with the largest and smallest numbers in the given list.
  3. Write a function that takes an integer n as a parameter and prints the first n rows of the Pascal's triangle.
  4. Arrays: Write a program that tests if a 2D square array is symmetric about the diagonal from (0,0) to (n-1,n-1). (from EPI)
  5. Stacks and Queues: Write a programt to evaluate arithmetical expressions that use + and * applied to nonnegative integer arguments. Expressions are in reverse-Polish notation, e.g., 3 4 + 5 *, 1 3 + 5 7 + *. (from EPI)
  6. Hash tables: Write a program that finds the most common object in an array of objects. Each object is a pair of strings. Treat strings as being the same if they are equal when converted to lower case. (from EPI)
  7. Write a program to find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each "_" is a single digit. (from Euler)