5 Pages

ocaml-mp

Course: CS 440, Fall 2008
School: Illinois Tech
Rating:
 
 
 
 
 

Word Count: 1727

Document Preview

1 MP -- Basic OCaml CS 440 -- Fall 2007 Revision 1.0 Assigned September 14, 2007 Due September 24, 2007 1 Objectives This MP is designed to give you experience with basic OCaml syntax. We assume that you have not seen OCaml before, and have not used a functional programming language before, and so this functions as a tutorial. Objectives: Know how to manipulate the integer, float, string, Boolean, and tuple...

Register Now

Unformatted Document Excerpt

Coursehero >> Illinois >> Illinois Tech >> CS 440

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
1 MP -- Basic OCaml CS 440 -- Fall 2007 Revision 1.0 Assigned September 14, 2007 Due September 24, 2007 1 Objectives This MP is designed to give you experience with basic OCaml syntax. We assume that you have not seen OCaml before, and have not used a functional programming language before, and so this functions as a tutorial. Objectives: Know how to manipulate the integer, float, string, Boolean, and tuple types. Know how to write functions of single and multiple variables. Know how to write simple recursive functions over integers. 2 2.1 Background Interactive Compiler OCaml has two modes that we will use. The first is as an interactive compiler, the second is as a standalone compiler. The interactive compiler is started simply by typing ocaml at the command prompt. You will get a screen that looks like this: Objective Caml version 3.09.2 # The version number may change a bit, don't worry about that. The # character is the prompt in OCaml. You will type in an expression or a command for the compiler. When you are done, OCaml will compile the expression and evaluate it, and then display the result. For example, to evaluate "3 + 5", your session would look like this: Objective Caml version 3.09.2 # 3 + 5 ;; - : int = 8 # The two semicolons at the end are used in the interactive compiler to signal that you are finished entering an expression. They are not needed for a standalone program, and should not be entered. 2.2 Variables Global Variables To declare a global variable, use the let keyword: # let x = 3 + 5;; val x : int = 8 You will not have need to declare these often in real programs, but they can be useful for development purposes. 1 Local Variables A local let expression has the form let x = e1 in e2 This whole expression has two subexpressions. The subexpression e1 will be evaluated first and its value assigned to x. This variable is available to the subexpression e2 , which is evaluated next. The value of e2 will be considered the value of the entire let expression, and once it is finished the variable x goes out of scope and is destroyed. # let y = 3 in y + 5;; - : int = 8 Since a local let is an expression, it can be nested inside of another local let. # let y = 3 in let z = 5 in y + z;; - : int = 8 If there are multiple variables defined with the same name, the compiler will take the variable from the innermost scope first. The next example shows a global x and a local x which is used and then goes out of scope. # let x = 10;; val x : int = 10 # x + 5;; - : int = 15 # let x = 20 in x + 5;; - : int = 25 # x + 5;; - : int = 15 You should try different combinations of these to gain an intuition for how these work. 2.3 Writing Functions A function declaration looks like a global let. let f x y = e The above shows a function named f with two parameters x and y. The body of the function is the expression e. There is no limit to the number of parameters, as long as there is at least one. (A function with no parameters is simply a variable.) # let inc x = x + 1;; val inc : int -> int = <fun> # inc 20;; - : int = 21 # let plus a b = a + b;; val plus : int -> int -> int = <fun> # plus 10 5;; - : int = 15 # let x = 3 in plus x 5;; - : int = 8 2 2.4 Recursive Functions By adding the rec keyword, a function is made recursive. # let rec countdown n = if n < 1 then 0 else n + (countdown (n-1));; val countdown : int -> int = <fun> # countdown 5;; - : int = 15 2.5 Local Functions Many functions need helper functions, but usually there's no reason to have the helper function be visible to the outside world. In such a case, it is best to declare it as a local function by combining the syntax for functions and local variables. This is a common technique. # let rms a b = let sqr x = x *. x in sqrt (sqr a +. sqr b);; val rms : float -> float -> float = <fun> # rms 3.0 4.0;; - : float = 5. 2.6 Type Conversion OCaml is a strictly typed language. If a value of one type needs to be in a context expecting a different type, the value must first be converted. There are a number of built-in functions to accomplish this. string of int : int -> string float -> string string of float : int of float : float of int : float -> int int -> float Tuples Comma-separated values placed in parenthesis are called tuples. Usually the word tuple denotes two elements, and we can use the word pair to describe it, but any number is possible. A tuple with, for example, six elements will be called a 6-tuple. A tuple is considered a single parameter. Properly speaking, it is a (reference to a) data-structure which has references to its contents. In order for a tuple to be useful, there needs to be a way of accessing the contents. Here are three ways. The first way is to place the tuple in the function declaration itself. # let plust (a,b) = a + b;; val plust : int * int -> int = <fun> Note the type of the function: the asterisk should remind you of Cartesian products. The second way is to declare a tuple of variables with a local let. The following code takes a tuple and x deconstructs it into its component parts. # let plust x = let (a,b) = x in a + b;; val plust : int * int -> int = <fun> 3 The third way is to use built-in functions fst and snd. They can only be used for pairs, however. # let plust x = (fst x) + (snd x);; val plust : int * int -> int = <fun> All three of the above functions produce identical results. There is a fourth way, using the match keyword, but that will be introduced in a future MP. 3 Sectioning Notice the type of the following function: # let plus a b = a + b;; val plus : int -> int -> int = <fun> What does the type mean? The -> indicates a function. There are two ways to interpret this. The first interpretation is that plus is a function that takes two integers and returns an integer result. An equally valid interpretation is that plus takes an integer and returns a function, which itself takes an integer and returns an integer result. Whenever a function is given a proper subset of its arguments, the result is another function. This is called sectioning. Here is an example using plus. # let inc = plus 1;; val inc : int -> int = <fun> # inc 34;; - : int = 35 One useful shortcut in OCaml is that the built-in infix operators can be made into prefix operators by surrounding them with parentheses. These functions can then be sectioned. # let inc = (+) 1;; val inc : int -> int = <fun> Be careful if you want to section the multiplication operator. It is necessary to add a space before the first parenthesis and the asterisk, because (* is the begin comment delimiter. Use ( * ) to make multiplication into a prefix function. 4 Problems 1. Write a function timesi : 2. Write a function timesf : 3. Write a function timesti : int -> int -> int which multiplies two integers. float -> float -> float which multiplies two floats. int * int -> int which multiplies two integers in a tuple. The following problems will help you practice the above concepts. 4. Write a function timess : string -> string -> string which takes the string representations of two integers and returns a string representation of their product. 5. Write a function double : 6. Write a function fact : int -> int, using the sectioning technique and the timesi function. int -> int which returns the factorial of its argument. 4 7. Write a function pow : int -> int -> int which returns xn when given n and x in that order. (The operator ** will perform floating point exponentiation, but for this problem you must use recursion.) 8. Write a function foo : int -> int which takes an argument x and returns a2 + 3 a3 + 4 a7 , where a = x!. You should call the factorial function precisely one time for this function; the purpose of having you write it is to give you practice with local let expressions. 9. Write a function calc : int -> int which runs the "calculator game". The calculator game is this: start with a number x. If x is even, divide by two and play again. If x is odd, multiply by three and add ...

Textbooks related to the document above:
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Illinois Tech - CS - 440
MP 3 - Forth InterpreterCS 440 - Fall 2007Revision 1.0 Assigned October 17, 2007 Due October 31, 2007 Extension None1Objectives and BackgroundThe objective for this MP is to learn to write a simple interpreter. The language you will implement
Illinois Tech - CS - 331
Iterators1 GIVEN FILESCS 331 Lab 5: Iterators Spring 20080.1 ObjectivesIn this lab you will create two iterators for a singly linked list. Have experience using the Interface feature of Java. Know how to implement a traversal iterator. Know
Illinois Tech - CS - 480
RoboticsChapter 25Chapter 251OutlineRobots, Effectors, and Sensors Localization and Mapping Motion PlanningChapter 252Mobile RobotsChapter 253ManipulatorsP R R R RRConfiguration of robot specified by 6 numbers 6 degrees of
Illinois Tech - CS - 487
SoftwareEngineering:APractitionersApproach,6/eChapter9 DesignEngineering1DesignModelsAnalysismodelsfocusondescribingrequireddata,functions,andbehavior WHAT SoftwaredesigndealswithHOWthesoftwaretobestructured Whatarethemaincomponents How
Illinois Tech - CS - 445
JavaCS445ObjectOrientedDesignandProgrammingInput DataBox Java console (System.in) Scanner Class ExceptionsDialogCS445ObjectOrientedDesignandProgrammingUsing Dialog BoxesJOptionPane class is in the javax.swing package static methods pro
Illinois Tech - CS - 480
CS-480 I nference in first-order logicLecturer: Tom Lenaerts SWITCH, Vlaams Interuniversitair Instituut voor BiotechnologieOutline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chain
Illinois Tech - CS - 445
OO Application FrameworksChapter 8CS445ObjectOrientedDesignandProgrammingClass ScheduleDay Tuesday Thursday Tuesday Thursday Tuesday Thursday Tuesday Thursday Tuesday Thursday Tuesday Thursday Tuesday Thursday Date Topic 31-Oct Frameworks 2-N
Illinois Tech - CS - 445
OOPCS445ObjectOrientedDesignandProgrammingJava Must HaveTo write your first program, you need: The JavaTM 5 Platform, Standard Edition. A text editor. Notepad, the simple editor included with the Windows platforms.You can and should use
Illinois Tech - CS - 480
Uninformed SearchChapter 3Topic Outline Problem-solving agents A kind of goal-based agent Problem types Single state (fully observable) Search with partial information Problem formulation Example problems Basic search algorithms &quot;Uninf
Illinois Tech - CS - 480
CS-480: Representing UncertaintyChapter 13Outline Uncertainty Probability Syntax and Semantics Inference Independence and Bayes' RuleUncertaintyDefine action At = leave for airport t minutes before flight to Hong Kong Q: Will At get me the
Illinois Tech - CS - 445
OOP Class 2CS445ObjectOrientedDesignandProgrammingAn Object of classOPERATIONSSet Increment Write. . .TimeDATAPrivate data: hrs mins secs 8 25 42TimeCS445ObjectOrientedDesignandProgrammingDefinitionsCS445ObjectOrientedDesignandPr
Illinois Tech - CS - 480
Informed SearchChapter 4Outline Informed = use problem-specific knowledge Which search strategies? Best-first search and its variants Heuristic functions? How to invent them Local search and optimization Hill climbing, local beam search,
Illinois Tech - CS - 445
Input/Output OperationsWe did Dialog Box Java console (System.in) Scanner ClassTopics The java.io Package Reading from the Java Console Reading and Writing Text Files Reading Structured Text Files Using StringTokenizer Reading and Writing Obj
Illinois Tech - CS - 480
Intelligent AgentsChapter 2What is an Agent? An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuatorsSome Kinds of Agents Human agent: Sensors: Eyes, ears, nose,
Illinois Tech - CS - 445
ArraysCS 445Topics Single-Dimensional Arrays Declaring and Instantiating Arrays Accessing Array Elements Writing Methods Aggregate Array Operations Using Arrays in Classes Searching and Sorting Arrays Using Arrays as Counters Iterator Obj
Illinois Tech - CS - 445
Java AppletsCS445 Object Oriented Design and ProgrammingTopics Applet Structure Executing an Applet Applet Life Cycle Drawing Shapes with Graphics Methods Using Colors and Fonts Etc.CS445 Object Oriented Design and ProgrammingApple
Illinois Tech - CS - 445
Design PatternCS5851/Software Design Patterns Published by Gamma et al. 23 commonly used design patterns Creational Patterns Object creation Structural Patterns Static composition of classes Behavioral Patterns Dynamic interaction am
Illinois Tech - CS - 445
Design PatternCS5851/OO Generic Design Activities Find Classes Factor objects form classes Define class interfaces Define Inheritance Hierarchies Find relationships between class Goals Avoid Redesign Keep your design open Reuse as mu
Illinois Tech - CS - 445
ObjectOriented Design and Programming CS445 Threads in JavaIllinois Institute of TechnologyThreadsA Thread is single line of execution or a program unit that is executed independently of other parts of the program JVM executes each
Illinois Tech - CS - 445
Abstract Classes and Methods InterfacesCS445 Object Oriented Design and Programmingabstract Classes and MethodsAn abstract class is a class that is not completely implemented. Usually, the abstract class contains at least one abstract me
Illinois Tech - CS - 445
JavaCS445 Object Oriented Design and ProgrammingTopics Class Basics and Benefits Creating Objects Using Constructors Calling Methods Using Object References Calling Static Methods and Using Static Class Variables Using Predefined Java
Illinois Tech - CS - 445
Java AppletsCS445ObjectOrientedDesignandProgrammingTopics Applet Structure Executing an Applet Applet Life Cycle Drawing Shapes with Graphics Methods Using Colors and Fonts Etc.CS445ObjectOrientedDesignandProgrammingAppletsExecute
Illinois Tech - CS - 445
Design and Implementation ConceptsCS445 Object Oriented Design and ProgrammingDesign Concepts Public and Helper Classes Ordering Class Members Class Organization Design Guidelines Javadoc Canonical Form of Classes No-arg Construct
Illinois Tech - CS - 480
CS-480 Logical Agents and InferenceAIMA, Chapter 7Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem proving
Illinois Tech - CS - 441
Grading Criteria for Project Part-B FALL 2007NAMES: _Design:1. javadocs : authors and version variables all methods all classes 2. DESCRIPTIONS IN WORD DOCUMENT:Points: 4 1 1 1 1 1--Total 5Code and Presentation: FUNCTIONALITY/APPEARANCE1.
Illinois Tech - CS - 441
Grading Criteria for Project Part-B SPRING 2008NAMES: _Design:1. javadocs : authors and version variables all methods all classes 2. DESCRIPTIONS IN WORD DOCUMENT:Points: 4 1 1 1 1 1--Total 5Code and Presentation: FUNCTIONALITY/APPEARANCE1
Illinois Tech - CS - 201
CS201 In Class Assignment - Form groups of 3 or 4 students. Your group will be assigned an example implementation of the below problem (A, B or C). I have also emailed all three implementations to everyone. By the end of class today, have your group
Illinois Tech - CS - 201
CS201 EXAM 1 Fall 2007 NAME _ 1. (20 points) Write a java code segment that will determine if the digits of a user entered, threedigit number are all odd, all even, or mixed odd and even. You can assume the user enters an integer.
Illinois Tech - CS - 201
CS201INCLASSASSIGNMENTNAME_SomepracticeonRecursion Writerecursive methods forthefollowing: 1. Calculate thenth term inthefibonaccisequence 2. Find thelargest integer inan array and return itsindex 3. Doalinear search forakeyonan array ofintegers,
Illinois Tech - CS - 201
CS201Fall2007EXAM#3NAME_ 1)(25points)WriteaVehicleclassforatollbooth collection system (standard cartollof50centsfor automatic,$1formanual) with thefollowing: Necessary constants Instance variables fortheVehicle's o tolltype String,A forautomatic,M
Illinois Tech - CS - 201
CS201EXAM2Fall2007 NAME_ 1.(50points)Writeaprogram that plays aguessing game. Thegame willpickarandom number between 2 setvalues (alow limitand high limit)and prompt theuser toguess that number untilheorsheguesses correctly.On each wrong guess,thega
Illinois Tech - CS - 201
CS201INCLASSASSIGNMENTNAME_Designandimplemementaclassforastopwatch.Allowtheusertostart,stopandresetthestopwatchanddisplay (toString)thetimeinseconds. ExtraCredit:Display(toString)thetimeashh:mm:ssLimitthetimeyoucancountto24hours,thenrolloverto0ag
Illinois Tech - CS - 201
CS201INCLASSASSIGNMENTNAME_SomepracticeonInhertiance Suppose you wanted aclassthat would allow you touse fractions inaprogram (weareNOT reducing orsimplifying fractions).Remember avalid fraction isan integer over anonzero integer. Wewant both a
Illinois Tech - CS - 201
CS201 EXAM 2 MAKEUP Fall 2007 NAME _ 1. (50 points) Write a program that plays a guessing game. The game will pick a random number between 2 set values (a low limit and high limit) and prompt the user to guess that number until
Illinois Tech - CS - 201
CS201 PLACEMENT EXAM 45 MINUTES NAME _ 1. Please write code / pseudocode for two new functions for the &quot;ThreeIntMath &quot; class: &quot;polynomial&quot; that assumes the three integers x, y, z, for an object are the integer coefficients of a pol
Illinois Tech - CS - 115
CS 115 FALL 2007 Lab Problem #12 CD Compilation Part A, IndividualIndividually read the memo and article below.Internal Memo Brand New Sound Co. To: New Hire Engineering Team From: Billy Valens, Vice President of Marketing Re: Product Mixing Hel
Illinois Tech - CS - 441
SPRING 08 Project B Version 1You must answer the questions below which are worth 10 points. Every point you loose by not giving the correct answer gets subtracted from your grade for your project during your presentation. Question 1: In a a RMI dis
Illinois Tech - CS - 116
102726710 graduated104685526 graduated105708840 inactive106703604 inactive108788932 inactive110724715 graduated112482628 inactive-n113740426 graduated115863141 graduated116729274 inactive117669891 graduated118703144 inactive118726395 inac
Illinois Tech - CS - 116
IIT - CS116 Lab 0file:/C|/Bauer/CS116/www/labs/Lab0/Lab0.htmCS 116 - Lab 0 Objectives:1. 2. 3. 4. 5. 6.Tasks:Enter, compile, and run simple Java programs without using an IDE. (the standard &quot;Hello World!&quot; first program). Recognize syntax err
Illinois Tech - CS - 116
Encapsulation &amp; Selection1EncapsulationClass implementation details are hidden from the programmer who uses the class. This is called encapsulation Public methods of a class provide the interface between the application code and the class object
Illinois Tech - CS - 116
Chapter 9 TopicsAtomic Data Types q Composite Data Types q One-Dimensional Arrays q Examples of Declaring and Processing Arrays q Arrays of Objects q Arrays and Methods q Special Kinds of Array Processingq1Java Primitive Data Typesprimitivein
Illinois Tech - CS - 116
Chapter 10 Inheritance, Polymorphism, and Scope1Chapter 10 Topicsq qq q q q q qInheritance Inheritance and the Object-Oriented Design Process How to Read a Class Hierarchy Derived Class Syntax Scope of Access Implementing a Derived Class Copy
Illinois Tech - CS - 116
Chapter 11 Array-Based Lists1Chapter 11 Topicsqq q q qq qInsertion into and Deletion from an Unordered List Straight Selection Sort Insertion into and Deletion from a Sorted List Abstract classes Searching s Sequential s Binary Complexity o
Illinois Tech - CS - 116
q Chapter q Writing7.8 - Exceptionsto a File Complexityq Algorithmic1ExceptionsqIllegal operations at run time can generate an exception, for example:s ArrayIndexOutOfBoundsException s ArithmeticException s NullPointerException s InputM
Illinois Tech - CS - 116
Chapter 8 Object-OrientedSoftware Design and Implementation TopicsSoftware Design Strategies q Objects and Classes Revisited q Object-Oriented Design q The CRC Card Design Process q Functional Decomposition q Object-Oriented Implementationq1So
Illinois Tech - CS - 116
1.(5 points) Understand and correct Java compile errors and runtime errors (conditions and iteration). Programming and Problem Solving with Java, Page 271, #10if (Math.abs(x2-x1)&lt;.00001) System.out.println(&quot;Slope undefined&quot;);else { m=(y2-y1)/(
Illinois Tech - CS - 116
1. (10 points) Determine the time complexity of simple algorithms. PREDICTED WHYSELECTION SORT n^2 2 nested loopsRANDOM inner loop n, n-1, n-2, n-3, etc n+(n-1)+(n-2)+. =
Illinois Tech - CS - 116
1.(6 points) Explain the basics of the concept of recursion. 1. (A) The number of elements in arr that are less than num 2. (D) 43211234 3. (D) 2432.(14 points) Design/Code an object for a multi-object application containing inheritance.
Illinois Tech - CS - 116
0.0178173520.0240969550.0482115620.0697062060.0787579870.0821025160.0851559690.0887409080.094427750.1313963520.133466550.1475134060.1476946620.1611041470.1623873830.1654102610.1658394070.1789697390.1838542270.1955364310.210542828
Illinois Tech - CS - 116
1. (20 points) Design a user-defined object containing an array. (CONTINUATION OF LAB 2,5,6)There is ALOT of flexibility on student answers on this one.Key idea is how they are protecting the cases from EVERYONE until you open a case.public cla
Illinois Tech - CS - 116
CS 116 SPRING 2008 , SECS. 3-6 LAB #10 ARRAYLIST SOLUTIONExercise #1 = #4: See ExerciseApp in suggested coded solution. Solution: I took a List class and derived a UserList class and overrode some methods. Most students will just create a UserLis
Illinois Tech - CS - 116
CS 116 SPRING 2008 , SECS. 3-6 LAB #5 ARRAYS SOLUTION Homework: Programming &amp; Problem Solving with Java,2nd Ed, Dale &amp; Weems: p. 518: #1, #2, #3 Exercise #1: See coded solution. Exercise #2: See coded solution. Write the pseudocode to solve this pr
Illinois Tech - CS - 116
CS 116 SPRING 2008 , SECS. 3-6 LAB #3 SELECTION + DEBUG SOLUTIONHomework: Programming &amp; Problem Solving with Java,2nd Ed, Dale &amp; Weems: (1 point) p. 270: #6, 9, 10, 116.if (year % 4 = 0) System.out.print(year + &quot; is a leap year.&quot;); else { year
Illinois Tech - CS - 116
CS 116 SPRING 2008 , SECS. 3-6 LAB #9 POLYMORPHISM Objective 1. 2. 3. 4.To learn to use polymorphism. To learn to read and handle an input file with two input formats. To learn to use an Abstract class. To learn the difference between private and
Illinois Tech - CS - 116
CS 116SPRING 2008 WEEKLY LAB PROBLEM #11 SEARCHING AND SORTING AN ARRAY LIST SOLUTION Ex. #1: See exercises package. Test valuepluShort.txtSearch result before selection sort:found 3016 at: 56 found 3082 at: 28 found 3251 at: -1 found 3161 at: 48
Illinois Tech - CS - 116
CS 116 SPRING 2008 , SECS. 3-6 LAB #2 USER-DEFINED CLASS + APPLICATION Objective: 1. Learn to write java arithmetic expressions. 2. Learn to use explicit casting. 3. Learn to use static methods from the Math API 4. Learn to use precedence of operat
Illinois Tech - CS - 116
CS 116 SPRING 2008, Sec. 3-6 LAB #1 USER-DEFINED CLASS WITH STATIC METHODS SOLUTION Homework: p. 100, #15: (1 point)This program may be corrected in several ways. Here is one correct version: public class LotsOfErrors { public static void main(Stri
Illinois Tech - CS - 116
CS 116SPRING 2007 WEEKLY LAB PROBLEM #8A ID ARRAY LIST Object: To learn how to implement an array list of objects Problem: The philanthropic organization would like to be able to have non-technical personnel manipulate the data stored in the data st
Illinois Tech - CS - 116
CS 116 SPRING 2008 , SECS. 3-6 LAB #8 INHERITANCE, COMPOSITION SOLUTIONExercise #1:Rectangle: length: 4 width: 5 area 20 perimeter: 18 Box: length: 8 width: 6 area 48 perimeter: 28 depth: 4 volume: 192Exercise #2:Length: 8 Width: 6 Width: 12
Illinois Tech - CS - 116
CS 116 SPRING 2008 , SECS. 3-6 LAB #4 ITERATION, FILE I/O SOLUTIONHomework: Programming &amp; Problem Solving with Java,2nd Ed, Dale &amp; Weems: p. 333: #2, 3, 5, 8, 10, 11 Grade #2, 5, 10 1 point apiece2. while ( ! dangerous ) { pressure = datain.nex
Illinois Tech - CS - 116
CS 116SPRING 2008 WEEKLY LAB PROBLEM #11 SEARCHING AND SORTING AN ARRAY LIST Objective: 1. To start coding your final project. 2. To search an array of objects using sequential search. 3. To sort an array of objects using selection sort. 4. To search