Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 9

Algorith

m
 a finite list of well-defined
instructions for accomplishing
some task that, given an initial
state, will terminate in a defined
end-state.
 essential to the way computers
process information.
 is a precise list of precise steps
 considered to be any sequence of
operations that can be performed
Algorithm
Notation
 Natural languages -
ambiguous and rarely used
 Pseudocode
Structured way to
express algorithm
 Flowcharts & independent of
Programming
 ProgrammingLanguages
languages –
intended only in a form that
Heuristi
c
 any algorithm that gives up
finding the optimal solution for
an improvement in run time
 can be a function that estimates
the cost of the cheapest path
from one node to another
 a technique designed to solve a
problem that ignores whether the
solution can be proven to be
correct
Genetic
Algorithm
 is a search technique used
in computing to find true or
approximate solutions to
optimization and search
problems.
 inheritance, mutation,
selection, and crossover
Inheritance
CLASS PERSON
public class Person
{
private String name;

public void setPerson(String


newName)
{
name="no name yet";
name=newName;
public String getName()
{
return this.name;
}
public void writeOutput()
{
System.out.println("Name="+name);
}}
CLASS STUDENT

public class Student extends Person


{
private int studNumber;
public Student(String initialName,int
initialNumber)
{
studNumber=0;
}
public void reset(String newName,int
newNumber)
{
setPerson(newName);
public void setNumber (int
newNumber){
studNumber=newNumber;}

public int getNumber(){


return(studNumber);}

public void writeOutput()


{

System.out.println("Name"+getName(
));
CLASS CALLER
public class Caller
{
public static void main(String[]
args)
{
Person s= new Person();
s.setPerson("Laura");
s.setNumber(123);
s.writeOutput();

You might also like