Introduction_Part_11

Introduction_Part_11 - A currentMax A[0 for i 1 to n 1 do...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Last Updated: January 5, 2012 CSE 2011 Prof. J. Elder Subtyping with Wildcards In order to obtain this kind of subtyping with generics, you can use wildcards . For example: or Couple<? extends Camera, ? extends Camera> stereoCamera = new Couple<DigitalCamera,DigitalCamera>(); Couple<? extends Camera, ? extends Camera> stereoCamera = new CloselyCouple<DigitalCamera,DigitalCamera>();
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last Updated: January 5, 2012 CSE 2011 Prof. J. Elder Pseudocode High-level description of an algorithm More structured than English prose Less detailed than a program Preferred notation for describing algorithms Hides program design issues Algorithm arrayMax ( A , n ) Input array A of n integers Output maximum element of
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A currentMax A [0] for i 1 to n- 1 do if A [ i ] > currentMax then currentMax A [ i ] return currentMax Example: find max element of an array Last Updated: January 5, 2012 CSE 2011 Prof. J. Elder Pseudocode Details • Control flow – if … then … [ else … ] – while … do … – repeat … until … – for … do … – Indentation replaces braces • Method declaration Algorithm method ( arg [, arg … ]) Input … Output … • Method call var.method ( arg [, arg …]) • Return value return expression • Expressions Assignment (like = in Java) = Equality testing (like == in Java) n 2 Superscripts and other mathematical formatting allowed...
View Full Document

{[ snackBarMessage ]}

Page1 / 3

Introduction_Part_11 - A currentMax A[0 for i 1 to n 1 do...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online