Recitation #2 Abstract Data Types, Collection Classes, and Linked List
|
|
- Leslie Carter
- 6 years ago
- Views:
Transcription
1 Recitation #2 Abstract Data Types, Collection Classes, and Linked List (1) Create an ADT Fraction that describes properties of fractions. Include the constructor, setter, getter, and tostring() methods and write the following operation methods in your Fraction class. (a) add, (b) subtract, (c) multiply, (d) divide, and (e) invert. Write a test class to test your Fraction ADT. Here are some operations on fractions: add a/b + c/d = (ad + bc)/bd subtract a/b - c/d = (ad - bc)/bd multiply a/b * c/d = ac/bd divide a/b c/d = ad/bc invert invert(a/b) = b/a Steps of ADT Design and Implementation: Study the properties of the data abstraction and develop a list of operations that it should provide. A fraction is the quotient of two numbers a/b, where a and b are both integers and b 0. a is called the numerator and b the denominator. So, the attributes for a fraction object: 1. int numerator 2. int denominator public class Fraction { private int num ;//numerator private int den ;//denominator public Fraction () { num = 0; den = 1; } public Fraction ( int n, int d ) // constructor { // assign num = n & den = d as long as d!= 0 if ( d == 0 ) { throw new IllegalArgumentException (); } else { num = n; den = d; }
2 } // getter methods public int getnum () { return this. num ; } public int getden () { return this. den ; } // setter methods public void setnum ( int n ) { this. num = n ; } public void setden ( int d ) { if ( d == 0 ) { throw new IllegalArgumentException (); } else { this. den = d; } } private static int gcd ( int x, int y) { /* gcd() method finds the greatest common divisor of * the 2 int variables passed and returns that value * */ int mod ; // hold a value temporarily to allow switch if ( x < y ) // always use the larger value as the divisor { mod = x; x = y; y = mod ; } int r = x % y ; // r holds the remainder of modulus division while ( r!= 0 )// while modulus division does not result in zero { x = y ; y = r; r = x % y ; } return y; } private Fraction reduce ( int n, int d) { int gcdnum = gcd ( n, d ); d = d / gcdnum ; // reduce the denominator using the gcd foun in gcd method n = n / gcdnum ; // reduce the numerator using the gcd foun in gcd method return new Fraction ( n, d ); // return the new fraction object in lowest form } // Operations public Fraction add ( Fraction b) { int num1 = ( this. num * b. den ) + ( b. num * this. den ); // cross multily and add int num2 = this. den * b. den ; // multiply the denominators to make them equivlent return reduce ( num1, num2 ); // calls reduce() method and returns a new Fraction object }
3 public Fraction subtract ( Fraction b) { int num1 = ( this. num * b. den ) - ( b. num * this. den ); // cross multiply and subtact int num2 = this. den * b. den; return reduce ( num1, num2 ); // sends to reduce method } public Fraction multiply ( Fraction b) { int num1 = this. num * b. num ; // multiplys straight accross int num2 = this. den * b. den; return reduce ( num1, num2 ); // sends to reduce method and returns the reduced fraction to the //tostring() method } public Fraction divide ( Fraction b) { int num1 = this. num * b. den ; //multiplys the inverse of 2nd fraction object to divide int num2 = this. den * b. num; return reduce ( num1, num2 ); // sends to reduce method } public Fraction invert () { return new Fraction ( this. den, this. num ); } public String tostring ()// *** convert to a mixed fraction for output only { if ( num > den && den > 1 ) //if true will show fraction object and mixed number return ( num + "/" + den + " or " + ( num / den ) + " " + ( num % den ) + "/" + den ); else return ( num + "/" + den ); //will not try to convert fraction object to mixed number } public static void main ( String args []) { Fraction x = new Fraction ( 1, 2 ); Fraction y = new Fraction ( 1, 3 ); Fraction z = x. add ( y ); System. out. println ( "Result: " + z. tostring ()); z = x. subtract ( y ); System. out. println ( "Result: " + z. tostring ()); z = x. multiply ( y ); System. out. println ( "Result: " + z. tostring ()); z = x. divide ( y ); System. out. println ( "Result: " + z. tostring ()); z = x. invert (); System. out. println ( "Result: " + z. tostring ()); } }
4 (2) Write a code to remove the duplicate elements of an array. import java. util. Arrays ; public class Duplicate { static void unique_array ( int [] my_array ) { //Assuming all elements in input array are unique int no_unique_elements = my_array. length ; //Comparing each element with all other elements for ( int i = 0 ; i < no_unique_elements ; i ++ ) { for ( int j = i + 1 ; j < no_unique_elements ; j ++ ) { //If any two elements are found equal if ( my_array [ i ] == my_array [ j ]) { //Replace duplicate element with last unique element my_array [ j ] = my_array [ no_unique_elements - 1 ]; no_unique_elements -- ; j -- ; } } } //Copying only unique elements of my_array into array1 int [] array1 = Arrays. copyof ( my_array, no_unique_elements ); //Printing arraywithoutduplicates for ( int i = 0 ; i < array1. length ; i ++ ) { System. out. print ( array1 [ i ] + "\t" ); } } public static void main ( String [] args ) { unique_array ( new int [] { 0, 3, - 2, 4, 3, 2 }); unique_array ( new int [] { 10, 22, 10, 20, 11, 22 }); } }
5 (3) Write a code to find the median of an array of integers with n elements. Hint: Sort the array (e.g., using insertion sort shown in class). If the array has odd number of elements return the middle element A[n/2], and it has even number of elements return (A[(n/2)-1]+A[n/2]) /2. (4) Given an array, a linked list, and a doubly linked list, determine which data structure(s) would be better for storing a collection of values in the following situations (and explain why) (a)elements are usually accessed in sequence (b)the initial size is unknown and can vary widely during execution (c)elements are frequently accessed randomly (d)elements are accessed sequentially, but sometimes in reverse order (a) Linked list/doubly linked list; as nodes can only be accessed by traversing the list in order (b) Linked list/doubly linked list; as nodes are only created as needed, array might need to be resized (c) Array, because you can access each element by index in O(1) time (d) Doubly linked list, because you have references to the next and previous node (5) Suppose you have a linked list with integer type data. Write a method called findmaxelement that returns a reference to the node of the linked list which contains the maximum element, by only traversing the list ONCE. public Node findmaxelement () { if ( head == null ) return null; Node maxelement = head; Node current = head; while ( current!= null ) { current = current. getnext(); if ( current!= null && current. getdata() > maxelement. getdata() ) { maxelement = current; } } return maxelement; } (6) What does the following function do for a given linked list if you call it with a head node? void method ( Node node ) { if ( node == null) return; method ( node. getnext ()); System. out. println ( node. getdata (). tostring ()); } What is the time complexity of this code?
6 Prints the nodes of the linked list in reverse order. This code takes O (n). (7) Write a function to return the middle element of a Linked List in one pass. public Node getmiddleelement () { if ( head == null ) return null; Node current = head; int length = 0; Node middle = head; while ( current. getnext ()!= null ){ length ++; if ( length % 2 == 0 ){ middle = middle. getnext (); } current = current. getnext (); } if ( length % 2 == 1 ){ middle = middle. getnext (); } return middle; }
CIT 590 Homework 6 Fractions
CIT 590 Homework 6 Fractions Purposes of this assignment: Get you started in Java and Eclipse Get you comfortable using objects in Java Start looking at some common object uses in Java. General Idea of
More informationMini-Lesson 1. Section 1.1: Order of Operations PEMDAS
Name: Date: 1 Section 1.1: Order of Operations PEMDAS If we are working with a mathematical expression that contains more than one operation, then we need to understand how to simplify. The acronym PEMDAS
More informationRational numbers as decimals and as integer fractions
Rational numbers as decimals and as integer fractions Given a rational number expressed as an integer fraction reduced to the lowest terms, the quotient of that fraction will be: an integer, if the denominator
More informationRational number operations can often be simplified by converting mixed numbers to improper fractions Add EXAMPLE:
Rational number operations can often be simplified by converting mixed numbers to improper fractions Add ( 2) EXAMPLE: 2 Multiply 1 Negative fractions can be written with the negative number in the numerator
More information3.1 Dividing a Whole into Fractional Parts. 3.1 Dividing a Set into Fractional Parts. 3.2 Identifying Parts of Wholes.
. Dividing a Whole into Fractional Parts Fraction: represents a part of a whole object or unit Numerator: (top number) represents number of parts of the whole Denominator: (bottom number) represents how
More informationPractice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course
: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course 1. Given the following hierarchy: class Alpha {... class Beta extends Alpha {... class Gamma extends Beta {... In what order
More informationLesson 1: Arithmetic Review
In this lesson we step back and review several key arithmetic topics that are extremely relevant to this course. Before we work with algebraic expressions and equations, it is important to have a good
More informationAP Computer Science. TextLab05 Java Assignment. Assignment Purpose: Do not copy this file, which is provided. TextLab05 Student Version
AP Computer Science The Rational Class Program II TextLab05 Java Assignment 80, 90 & 100 Point Versions Assignment Purpose: The purpose of this lab is to demonstrate knowledge of creating a class with
More informationSection 2.3 Rational Numbers. A rational number is a number that may be written in the form a b. for any integer a and any nonzero integer b.
Section 2.3 Rational Numbers A rational number is a number that may be written in the form a b for any integer a and any nonzero integer b. Why is division by zero undefined? For example, we know that
More informationFractions. Dividing the numerator and denominator by the highest common element (or number) in them, we get the fraction in its lowest form.
Fractions A fraction is a part of the whole (object, thing, region). It forms the part of basic aptitude of a person to have and idea of the parts of a population, group or territory. Civil servants must
More informationLearning Log Title: CHAPTER 3: ARITHMETIC PROPERTIES. Date: Lesson: Chapter 3: Arithmetic Properties
Chapter 3: Arithmetic Properties CHAPTER 3: ARITHMETIC PROPERTIES Date: Lesson: Learning Log Title: Date: Lesson: Learning Log Title: Chapter 3: Arithmetic Properties Date: Lesson: Learning Log Title:
More informationAny Integer Can Be Written as a Fraction
All fractions have three parts: a numerator, a denominator, and a division symbol. In the simple fraction, the numerator and the denominator are integers. Eample 1: Find the numerator, denominator, and
More informationMath Circle Beginners Group October 18, 2015 Solutions
Math Circle Beginners Group October 18, 2015 Solutions Warm-up problem 1. Let n be a (positive) integer. Prove that if n 2 is odd, then n is also odd. (Hint: Use a proof by contradiction.) Suppose that
More information50 MATHCOUNTS LECTURES (6) OPERATIONS WITH DECIMALS
BASIC KNOWLEDGE 1. Decimal representation: A decimal is used to represent a portion of whole. It contains three parts: an integer (which indicates the number of wholes), a decimal point (which separates
More informationChapter 4 Section 2 Operations on Decimals
Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.
More informationAccuplacer Arithmetic Study Guide
Accuplacer Arithmetic Study Guide I. Terms Numerator: which tells how many parts you have (the number on top) Denominator: which tells how many parts in the whole (the number on the bottom) Example: parts
More informationInteger Operations. Summer Packet 7 th into 8 th grade 1. Name = = = = = 6.
Summer Packet 7 th into 8 th grade 1 Integer Operations Name Adding Integers If the signs are the same, add the numbers and keep the sign. 7 + 9 = 16-2 + -6 = -8 If the signs are different, find the difference
More informationJava Simple Data Types
Intro to Java Unit 1 Multiple Choice Java Simple Data Types DO NOT WRITE ON THIS TEST This test includes program segments, which are not complete programs. Answer such questions with the assumption that
More informationJAVA OPERATORS GENERAL
JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators
More informationIntroduction to Computer Science Midterm 3 Fall, Points
Introduction to Computer Science Fall, 2001 100 Points Notes 1. Tear off this sheet and use it to keep your answers covered at all times. 2. Turn the exam over and write your name next to the staple. Do
More informationEE 152 Advanced Programming LAB 7
EE 152 Advanced Programming LAB 7 1) Create a class called Rational for performing arithmetic with fractions. Write a program to test your class. Use integer variables to represent the private data of
More informationMath Glossary Numbers and Arithmetic
Math Glossary Numbers and Arithmetic Version 0.1.1 September 1, 200 Next release: On or before September 0, 200. E-mail edu@ezlink.com for the latest version. Copyright 200 by Brad Jolly All Rights Reserved
More informationJava Simple Data Types
Intro to Java Unit 1 Multiple Choice Test Key Java Simple Data Types This Test Is a KEY DO NOT WRITE ON THIS TEST This test includes program segments, which are not complete programs. Answer such questions
More informationCreating a new data type
Appendix B Creating a new data type Object-oriented programming languages allow programmers to create new data types that behave much like built-in data types. We will explore this capability by building
More information3.3 Division of Fractions and of Mixed Numbers
CCBC Math 0 Division of Fractions and of Mixed Numbers Section.. Division of Fractions and of Mixed Numbers Introduction: http://youtu.be/fsdtivjjq What does it mean to divide? The basic division questions
More informationIntegers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not.
What is an INTEGER/NONINTEGER? Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not. What is a REAL/IMAGINARY number? A real number is
More informationFractions. There are several terms that are commonly used when working with fractions.
Chapter 0 Review of Arithmetic Fractions There are several terms that are commonly used when working with fractions. Fraction: The ratio of two numbers. We use a division bar to show this ratio. The number
More informationReteaching. Comparing and Ordering Integers
- Comparing and Ordering Integers The numbers and - are opposites. The numbers 7 and -7 are opposites. Integers are the set of positive whole numbers, their opposites, and zero. 7 6 4 0 negative zero You
More informationUnit 1 Integers, Fractions & Order of Operations
Unit 1 Integers, Fractions & Order of Operations In this unit I will learn Date: I have finished this work! I can do this on the test! Operations with positive and negative numbers The order of operations
More informationProf. Navrati Saxena TA: Rochak Sachan
JAVA Prof. Navrati Saxena TA: Rochak Sachan Operators Operator Arithmetic Relational Logical Bitwise 1. Arithmetic Operators are used in mathematical expressions. S.N. 0 Operator Result 1. + Addition 6.
More informationSummer Packet 7 th into 8 th grade. Name. Integer Operations = 2. (-7)(6)(-4) = = = = 6.
Integer Operations Name Adding Integers If the signs are the same, add the numbers and keep the sign. 7 + 9 = 16 - + -6 = -8 If the signs are different, find the difference between the numbers and keep
More informationNumber System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value
1 Number System Introduction In this chapter, we will study about the number system and number line. We will also learn about the four fundamental operations on whole numbers and their properties. Natural
More informationModular Arithmetic. Marizza Bailey. December 14, 2015
Modular Arithmetic Marizza Bailey December 14, 2015 Introduction to Modular Arithmetic If someone asks you what day it is 145 days from now, what would you answer? Would you count 145 days, or find a quicker
More informationSection A Arithmetic ( 5) Exercise A
Section A Arithmetic In the non-calculator section of the examination there might be times when you need to work with quite awkward numbers quickly and accurately. In particular you must be very familiar
More informationDECIMAL FRACTIONS. Thus, 0.25=25/100=1/4;2.008=2008/1000=251/125.
DECIMAL FRACTIONS I. Decimal Fractions : Fractions in which denominators are powers of 10 are known as decimal fractions. Thus,1/10=1 tenth=.1;1/100=1 hundredth =.01; 99/100=99 hundreths=.99;7/1000=7 thousandths=.007,etc
More informationCourse Learning Outcomes for Unit I. Reading Assignment. Unit Lesson. UNIT I STUDY GUIDE Number Theory and the Real Number System
UNIT I STUDY GUIDE Number Theory and the Real Number System Course Learning Outcomes for Unit I Upon completion of this unit, students should be able to: 2. Relate number theory, integer computation, and
More information8 th Grade Math Reference Sheet
8 th Grade Math Reference Sheet Number Sense DECIMALS NS 1 To change a DECIMAL FRACTION, use the place value of the decimal as the denominator of the fraction; simplify if. 1. Line up decimal points 2.
More informationThis exam is open book. Each question is worth 3 points.
This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or
More informationSUMMER REVIEW PACKET 2 FOR STUDENTS ENTERING ALGEBRA 1
SUMMER REVIEW PACKET FOR STUDENTS ENTERING ALGEBRA Dear Students, Welcome to Ma ayanot. We are very happy that you will be with us in the Fall. The Math department is looking forward to working with you
More informationFraction to Percents Change the fraction to a decimal (see above) and then change the decimal to a percent (see above).
PEMDAS This is an acronym for the order of operations. Order of operations is the order in which you complete problems with more than one operation. o P parenthesis o E exponents o M multiplication OR
More informationEquations and Problem Solving with Fractions. Variable. Expression. Equation. A variable is a letter used to represent a number.
MAT 040: Basic Math Equations and Problem Solving with Fractions Variable A variable is a letter used to represent a number. Expression An algebraic expression is a combination of variables and/or numbers
More informationRational Number is a number that can be written as a quotient of two integers. DECIMALS are special fractions whose denominators are powers of 10.
PA Ch 5 Rational Expressions Rational Number is a number that can be written as a quotient of two integers. DECIMALS are special fractions whose denominators are powers of 0. Since decimals are special
More informationLesson 1: Arithmetic Review
Lesson 1: Arithmetic Review Topics and Objectives: Order of Operations Fractions o Improper fractions and mixed numbers o Equivalent fractions o Fractions in simplest form o One and zero Operations on
More informationWhat is a Fraction? Fractions. One Way To Remember Numerator = North / 16. Example. What Fraction is Shaded? 9/16/16. Fraction = Part of a Whole
// Fractions Pages What is a Fraction? Fraction Part of a Whole Top Number? Bottom Number? Page Numerator tells how many parts you have Denominator tells how many parts are in the whole Note: the fraction
More informationFor Module 2 SKILLS CHECKLIST. Fraction Notation. George Hartas, MS. Educational Assistant for Mathematics Remediation MAT 025 Instructor
Last Updated: // SKILLS CHECKLIST For Module Fraction Notation By George Hartas, MS Educational Assistant for Mathematics Remediation MAT 0 Instructor Assignment, Section. Divisibility SKILL: Determine
More informationUnit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392
Lesson 1: Multiplying Integers and Decimals, part 1 factor: any two or more numbers multiplied to form a product 56 x 7 = 392 factors: 56, 7 product 392 Integers: all positive and negative whole numbers
More information( 3) ( 4 ) 1. Exponents and Radicals ( ) ( xy) 1. MATH 102 College Algebra. still holds when m = n, we are led to the result
Exponents and Radicals ZERO & NEGATIVE EXPONENTS If we assume that the relation still holds when m = n, we are led to the result m m a m n 0 a = a = a. Consequently, = 1, a 0 n n a a a 0 = 1, a 0. Then
More informationIron County Schools. Yes! Less than 90 No! 90 No! More than 90. angle: an angle is made where two straight lines cross or meet each other at a point.
Iron County Schools 1 acute angle: any angle that is less than 90. Yes! Less than 90 No! 90 No! More than 90 acute triangle: a triangle where all the angles are less than 90 angle: an angle is made where
More informationStudent Success Center Arithmetic Study Guide for the ACCUPLACER (CPT)
Fractions Terms Numerator: which tells how many parts you have (the number on top) Denominator: which tells how many parts in the whole (the number on the bottom) is parts have a dot out of Proper fraction:
More informationKey Java Simple Data Types
AP CS P w Java Unit 1 Multiple Choice Practice Key Java Simple Data Types This test includes program segments, which are not complete programs. Answer such questions with the assumption that the program
More informationName: Date: Review Packet: Unit 1 The Number System
Name: Date: Math 7 Ms. Conway Review Packet: Unit 1 The Number System Key Concepts Module 1: Adding and Subtracting Integers 7.NS.1, 7.NS.1a, 7.NS.1b, 7.NS.1c, 7.NS.1d, 7.NS.3, 7.EE.3 To add integers with
More informationLecture 13. Example. Encapsulation. Rational numbers: a number is rational if it can be defined as the ratio between two integers.
Lecture 13 Example Rational numbers: a number is rational if it can be defined as the ratio between two integers Issues in object-oriented programming The class Rational completed Material from Holmes
More information1-3 Multiplying and Dividing Real Numbers
Multiplying and Dividing 1-3 Multiplying and Dividing Real Numbers Real Numbers Warm Up Lesson Presentation Lesson Quiz 1 2 pts Bell Quiz 1-3 Add or Subtract 1. 3 8 2 pts 2. - 8 + 12 2 pts 3. 4 (-4) 2
More informationSection 1.2 Fractions
Objectives Section 1.2 Fractions Factor and prime factor natural numbers Recognize special fraction forms Multiply and divide fractions Build equivalent fractions Simplify fractions Add and subtract fractions
More informationWorking with classes and objects COSC346
Working with classes and objects COSC346 Initialisation An object should be self-contained: independent and selfsufficient Should allocate resources (memory) required for its operation Should initialise
More information1. To add (or subtract) fractions, the denominators must be equal! a. Build each fraction (if needed) so that both denominators are equal.
MAT000- Fractions Purpose One of the areas most frustrating for teachers and students alike is the study of fractions, specifically operations with fractions. Year after year, students learn and forget
More informationRational Expressions Sections
Rational Expressions Sections Multiplying / Dividing Let s first review how we multiply and divide fractions. Multiplying / Dividing When multiplying/ dividing, do we have to have a common denominator?
More information(3) Some memory that holds a value of a given type. (8) The basic unit of addressing in most computers.
CS 7A Final Exam - Fall 206 - Final Exam Solutions 2/3/6. Write the number of the definition on the right next to the term it defines. () Defining two functions or operators with the same name but different
More informationCW Middle School. Math RtI 7 A. 4 Pro cient I can add and subtract positive fractions with unlike denominators and simplify the result.
1. Foundations (14.29%) 1.1 I can add and subtract positive fractions with unlike denominators and simplify the result. 4 Pro cient I can add and subtract positive fractions with unlike denominators and
More informationCS 1302 Chapter 9 (Review) Object & Classes
CS 1302 Chapter 9 (Review) Object & Classes Reference Sections 9.2-9.5, 9.7-9.14 9.2 Defining Classes for Objects 1. A class is a blueprint (or template) for creating objects. A class defines the state
More informationRadical Expressions LESSON. 36 Unit 1: Relationships between Quantities and Expressions
LESSON 6 Radical Expressions UNDERSTAND You can use the following to simplify radical expressions. Product property of radicals: The square root of a product is equal to the square root of the factors.
More informationASSIGNMENT 3 Methods, Arrays, and the Java Standard Class Library
ASSIGNMENT 3 Methods, Arrays, and the Java Standard Class Library COMP-202B, Winter 2010, All Sections Due: Wednesday, March 3, 2010 (23:55) You MUST do this assignment individually and, unless otherwise
More informationCS1083 Week 2: Arrays, ArrayList
CS1083 Week 2: Arrays, ArrayList mostly review David Bremner 2018-01-08 Arrays (1D) Declaring and using 2D Arrays 2D Array Example ArrayList and Generics Multiple references to an array d o u b l e prices
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationCSCE 110: Programming I
CSCE 110: Programming I Sample Questions for Exam #1 February 17, 2013 Below are sample questions to help you prepare for Exam #1. Make sure you can solve all of these problems by hand. For most of the
More informationLecture 2: Number Systems
Lecture 2: Number Systems Syed M. Mahmud, Ph.D ECE Department Wayne State University Original Source: Prof. Russell Tessier of University of Massachusetts Aby George of Wayne State University Contents
More informationWhat is a Fraction? A fraction is a part or piece of something. The way we write fractions tells us the size of the piece we are referring to
October 0, 0 What is a Fraction? A fraction is a part or piece of something. The way we write fractions tells us the size of the piece we are referring to ⅝ is the numerator is the denominator is the whole
More informationCSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4
CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University Name: ID#: Section #: Score: / 4 Unit 7: Direct Proof Introduction 1. The statement below is true. Rewrite the
More informationCarleton University Department of Systems and Computer Engineering SYSC Foundations of Imperative Programming - Winter Lab 8 - Structures
Carleton University Department of Systems and Computer Engineering SYSC 2006 - Foundations of Imperative Programming - Winter 2012 Lab 8 - Structures Objective To write functions that manipulate structures.
More informationChapter 1: Number and Operations
Chapter 1: Number and Operations 1.1 Order of operations When simplifying algebraic expressions we use the following order: 1. Perform operations within a parenthesis. 2. Evaluate exponents. 3. Multiply
More informationCOMP-202 Unit 8: Defining Your Own Classes. CONTENTS: Class Definitions Attributes Methods and Constructors Access Modifiers and Encapsulation
COMP-202 Unit 8: Defining Your Own Classes CONTENTS: Class Definitions Attributes Methods and Constructors Access Modifiers and Encapsulation Defining Our Own Classes (1) So far, we have been creating
More informationTop of the Stack. Stack ADT
Module 3: Stack ADT Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu Stack ADT Features (Logical View) A List that
More informationJava provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:
Basic Operators Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College September 6, 2017 Outline Outline 1 Chapter 2: Data Abstraction Outline Chapter 2: Data Abstraction 1 Chapter 2: Data Abstraction
More information1 (5pts) 2 (20 pts) 3 (20 pts) 4 (10 pts) 5 (15 pts) 6 (30 pts) Total NAME: CU ID: Recitation instructor/time
CS 211 Computers and Programming Fall 2003 Prelim II 11/18/2003 NAME: CU ID: Recitation instructor/time You have one and a half hours to do this exam All programs in this exam must be written in Java Excessively
More informationName Student ID Number. Group Name. Group Members. Fractions
Name Student ID Number Group Name Group Members Fractions Many people struggle with and even fear working with fractions. Part of the reason people struggle is because they do not know what a fraction
More informationClasses and Objects in Java Instance Methods
Objects can be more than just collections of data; they can also have functionality, implemented through methods. The methods can be grouped into two categories instance methods and class methods. Creating
More informationIntroduction to Fractions
Introduction to Fractions Fractions represent parts of a whole. The top part of a fraction is called the numerator, while the bottom part of a fraction is called the denominator. The denominator states
More informationCSC 1214: Object-Oriented Programming
CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:
More informationObjective Simplify expressions using the properties of exponents.
Pre-Algebra: Exponent Properties Objective Simplify expressions using the properties of exponents. Exponents are used to simplify expressions. For example, a*a*a*a*a*a*a is the expanded expression of a
More informationData Structures. Alice E. Fischer. Lecture 4, Fall Alice E. Fischer Data Structures L4... 1/19 Lecture 4, Fall / 19
Data Structures Alice E. Fischer Lecture 4, Fall 2018 Alice E. Fischer Data Structures L4... 1/19 Lecture 4, Fall 2018 1 / 19 Outline 1 Ordered Lists 2 Sorted Lists Tail Pointers 3 Doubly Linked Lists
More informationStudy Guide For use with pages
. GOAL For use with pages Write fractions as decimals and vice versa. VOCABULARY A rational number is a number that can be written as a quotient of two integers. In a terminating decimal, the division
More information6.3. Complex Fractions
6. Comple Fractions 1. Simplify comple fractions by simplifying the numerator and denominator (Method 1).. Simplify comple fractions by multiplying by a common denominator (Method ).. Compare the two methods
More informationCS-140 Fall 2017 Test 2 Version A Nov. 29, 2017
CS-140 Fall 2017 Test 2 Version A Nov. 29, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : An interface defines the list of fields
More information! Addition! Multiplication! Bigger Example - RSA cryptography
! Addition! Multiplication! Bigger Example - RSA cryptography Modular Arithmetic Modular Exponentiation Primality Testing (Fermat s little theorem) Probabilistic algorithm Euclid s Algorithm for gcd (greatest
More informationCourse Supervisor: Dr. Humera Tariq Hands on Lab Sessions: Ms. Sanya Yousuf
Course Supervisor: Dr. Humera Tariq Hands on Lab Sessions: Ms. Sanya Yousuf UML to represent and using single object Practice writing code for class Practice tostring( ) function Practice writing your
More informationIntroduction to Computing II (ITI 1121) Final Examination
Université d Ottawa Faculté de génie École de science informatique et de génie électrique University of Ottawa Faculty of Engineering School of Electrical Engineering and Computer Science Introduction
More informationPre-Algebra Notes Unit Five: Rational Numbers and Equations
Pre-Algebra Notes Unit Five: Rational Numbers and Equations Rational Numbers Rational numbers are numbers that can be written as a quotient of two integers. Since decimals are special fractions, all the
More informationChapter 1 & 2 Calculator Test Study Guide
Chapter 1 & 2 Calculator Test Study Guide Powers and Exponents 1) To put a number to the second power, simply hit the x 2 key, then enter. 2) To put a number to the third or a higher power, key in base,
More informationCOURSE LEVEL UNIT/FOCUS Desired Results Transfer Meaning Acquisition
COURSE: Mathematics LEVEL: Grade 5 UNIT/FOCUS: Decimal Concepts Desired Results Related standard(s): 5.NBT.1 5.NBT.3 5.NBT.4 Transfer Students will be able to independently use their learning to Apply
More informationChapter 4: Writing Classes
Chapter 4: Writing Classes Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Writing Classes We've been using predefined classes. Now we will learn to write our own
More informationJava classes cannot extend multiple superclasses (unlike Python) but classes can implement multiple interfaces.
CSM 61B Abstract Classes & Interfaces Spring 2017 Week 5: February 13, 2017 1 An Appealing Appetizer 1.1 public interface Consumable { public void consume (); public abstract class Food implements Consumable
More informationProgramming Problems 22nd Annual Computer Science Programming Contest
Programming Problems 22nd Annual Computer Science Programming Contest Department of Mathematics and Computer Science Western Carolina University 5 April 2011 Problem One: Add Times Represent a time by
More informationClasses and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?
Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable
More informationCLASSIFICATION OF FRACTIONS 1. Proper Fraction : A Proper fraction is one whose numerator is less than its denominator. 1 eg., 3
CLASSIFICATION OF FRACTIONS. Proper Fraction : A Proper fraction is one whose numerator is less than its denominator. eg.,. Improper Fraction : An improper fraction is one whose numerator is equal to or
More informationLinked Lists. private int num; // payload for the node private Node next; // pointer to the next node in the list }
Linked Lists Since a variable referencing an object just holds the address of the object in memory, we can link multiple objects together to form dynamic lists or other structures. In our case we will
More informationBig Mathematical Ideas and Understandings
Big Mathematical Ideas and Understandings A Big Idea is a statement of an idea that is central to the learning of mathematics, one that links numerous mathematical understandings into a coherent whole.
More informationPrelim 1. CS 2110, October 1, 2015, 5:30 PM Total Question Name True Short Testing Strings Recursion
Prelim 1 CS 2110, October 1, 2015, 5:30 PM 0 1 2 3 4 5 Total Question Name True Short Testing Strings Recursion False Answer Max 1 20 36 16 15 12 100 Score Grader The exam is closed book and closed notes.
More informationCommon Core State Standard for Mathematics
Domain: Operations and Algebraic Clusters: Write and interpret numerical expressions 1. Use parentheses, brackets, or braces in numerical expressions and evaluate expressions with these symbols. CC.5.OA.1
More informationA.4 Rationalizing the Denominator
A.4 Rationalizing the Denominator RATIONALIZING THE DENOMINATOR A.4 Rationalizing the Denominator If a radical expression contains an irrational denominator, such as,, or 0, then it is not considered to
More information