SlideShare a Scribd company logo
DataStructuresandAlgorithms CSE153

Our Course contains 6 main parts:
2/64
 Part 1- Introduction to Data Structure and
Algorithm
 Part 2 – Array Data Structure
 Part 3- List Data Structure
 Part 4 –Stack And Queue Data Structure
 Part 5 – Tree and Table Data Structure.
 Part 6 – Algorithm (Sort and search )

Course Objective
The main objective of this course is to provide students with the
theoretical background and practical experience relating to the
design and implementation of Data structure. The main objectives of
the course are:
(1) Know the terminology associated with the Data structure
field.
 Data Structures Course Objectives
 Be familiar with basic techniques of algorithm analysis
 Master the implementation of linked data structures such as
linked lists and binary trees
 Be familiar with several sorting algorithms including
quicksort, mergesort
 Be familiar with path and minimum spanning tree
 Master the standard data structure library of a major
programming language (e.g. C#) 3

 Be able to classify data structures and
algorithms as “good/bad”.
 Know precise ways of analyzing
whether a data structure or algorithm is
good.
Course Objectives
4

Overall Picture
Data Structure and
Algorithm Design Goals
Implementation
Goals
Correctness
Efficiency
Robustness
Adaptability
Reusability

This course is not about:
 Programming languages
 Computer architecture
 Software architecture
 Software design and implementation principles
 Issues concerning small and large scale
programming
 We will only touch upon the theory of
complexity and computability 6
Overall Picture (2)

Weekly Periodical sheets to assess understanding each
chapter or terminated job
Report : to assess gain of specific chapter and task
Participation in the lecture to assess gain of specific
chapter and task
Lab activities to assess implementation of the practical
parts
Term project to assess understanding how to complete job
Mid term and final Exam
Assessment Methods
20% for and Projects and lab Activities
15 % for and lecture activities and attendance, Quizzes, report, project
15 % for midterm exam
50 % final exam 7

 A: 91-100
 A-: 89, 90
 B: 79 - 88
 C: 70 - 78
 D: 59 - 69
 F: 0 - 58
Grade scale
For a grade of C
or better you must have both:
•At least 300 points from all
programming assignments
•At least 300 points from exams
8

Notes
 Lecture attendance is very important. You lose ½
degree for each lecture you miss.
 Late submission of the tasks will be marked with
deduction of %10 per day.
 The assignments, and of course the quizzes, and
exams need to be done individually
 Students have to attend Exams or lecture on time
– No Excuse are accepted.
9

 All assignment are individual
 Plagiarism is not tolerated/ FSU Honor code strictly enforced (see
details in syllabus).
 Automated detection tools will be employed!
 Typically two weeks per-assignment
 Start early
 Ask questions early
 Submit on time
 Lateness policy (after 11:59PM on Fridays):
 10% penalty < 24 hours delay
 20% penalty < 48 hours delay
 No points awarded > 48 hours delay, except in special cases with
documented reasons
Assignments
10
part 1 -  intorduction data structure  2021 mte.ppt
part 1 -  intorduction data structure  2021 mte.ppt

Design
Produce Measurement/
Analysis
Reporting
3D Cad Model Authority
Process Scope
Computer in Industrial Life

Computer in Industrial Life

2D Drawing
Authority
2D Drawing
Interpretation
Digital Product Line Today
3D Design
3D Model Release
Tool Oriented
Detail Assembly
2D drawing Assembly
Inspection
3D Measurement
Equipment
MFG Engineering
NC Programming
Manufacturing
Quality Assurance
Tooling
Product
Integrated Digital Product Line
3D Model Assembly
Inspection
3d Model Oriented
Detail Assembly
And Authority

Wing Spar
Test Program
Aug 2000

Overview of 3D Measurement Pilot
Create 3D CAD Models of components, sub-assemblies and
major components
CATIA Model with Embedded Tolerancing
Local Area/Zone X-form from Part Attributes
Key Characteristics
FD&T Tolerances
Measurement Systems

Functional Dimensioning and Tolerancing (FDT)

Common Measurement Systems Interface
part 1 -  intorduction data structure  2021 mte.ppt

21
Define: Computer Program
• Series of instructions submitted to a computer to
accomplish a task- Instructions must be written in a way
the computer can understand
• An organized list of instructions that, when executed,
causes the computer to behave in a predetermined manner.
• A program contains a list of values (called variables) and a
list of directions (called statements) that tell the computer
what to do with the variables.
• The variables can represent numeric data, text, can be
organized (structured) in different way

Data Structure
 Systematic way of organizing and accessing data.
 are collection of variables, possibly of several different
data types, connected in various ways.
 A data structure is a group of data elements grouped
together under one name. These data elements, known
as members, can have different types and different
lengths.
Algorithm
 Step-by-step procedure for performing some task in a
finite amount of time.
Definitions

 A Set of Instructions
 Data Structures + Algorithms
 Data Structure = A Container stores Data
 Algoirthm = Logic + Control
What is Program

 Formal data structures enable a programmer to mentally
structure large amounts of data into conceptually manageable
relationships
 Sometimes we use data structures to allow us to do more: for
example, to accomplish fast searching or sorting of data.
 we can call the data structure an abstract data type (sometimes
abbreviated as ADT). Abstract data types can minimize
dependencies in your code
Benefit of Data Structure

 Algorithm
 Outline, the essence of a computational procedure,
step-by-step instructions
 Program – an implementation of an algorithm in
some programming language
 Data structure
 Organization of data needed to solve the problem
25
Data Structures and
Algorithms

 In programming, the term data structure refers to a
scheme for organizing related pieces of information.
The basic types of data structures include:
Array
lists
Stack
Queue
Tree
Table
Data structure and programming

 Abstract Data Type (ADT)
 A set of allowed data values, with a set of allowed
operations.
 Allows the user to create data types to their own
specifications
 All data must conform to the predefined structure, and this
data may only be manipulated through a set of predefined
operations.
 These operations must not violate the integrity of the data
structure.
 The purpose of the ADT is to shield the programmer from
the internal workings of the data structure, by giving access
to the data only through the operations.
Definitions

Has zero or more inputs.
Has at least 1 output.
Each instruction is unambiguous.
Terminates after a finite sequence of
instructions.
Each step is achievable.
Properties of an Algorithm

 design the algorithm
 goals:
 correctness
 efficiency
 verify and prove correctness
 goals:
 will it work for all cases?
 does it output the correct result?
Developing Algorithms

 analyze the algorithm
 goals:
 how long will it run?
 at what instance will it fail? Succeed?
 rate of change of execution as data size increases?
 implement the algorithm
 coding and programming
 goals:
 robustness – ability to handle unexpected inputs
 adaptability – ability to run with less changes in hardware &
operating system platforms
 reusability – use as diff component of other system for various
Developing Algorithms
(cont.)

 determine the running time of a program as a
function of its inputs;
 determine the total or maximum memory space
needed for program data;
 determine the total size of the program code;
 determine whether the program correctly
computes the desired result;
Analysis of an Algorithm
determine the complexity of the program
• how easy it is to read, understand, and modify
determine the robustness of the program
• how well does it deal with unexpected or erroneous
inputs?

 algorithm itself
 input data
 computer system used to run the program
Factors that Affect Running Time
hardware
processor used (type and speed);
memory available (cache and RAM) , and
disk available
the programming language in which the system is
specified;
the language compiler/interpreter used; and
the computer operating system software

 Knowledge of a programming language
 C#
 Task to solve
 Development environment, compilers, SDK
 Visual Studio, .NET Framework SDK
 Set of useful standard classes
 Microsoft .NET Framework FCL
 Help documentation
 MSDN Library 33
What You Need to Program?

 Programming language
A syntax that allow to give instructions to the
computer
 C# features:
New cutting edge language
Extremely powerful
Easy to learn
Easy to read and understand
Object-oriented 34
What is "C#"?
part 1 -  intorduction data structure  2021 mte.ppt

 Visual Studio – Integrated Development
Environment (IDE)
 Development tool that helps us to:
 Write code
 Design user interface
 Compile code
 Execute / test / debug applications
 Browse the help
 Manage project's files
36
Visual Studio

 Single tool for:
 Writing code in many languages (C#, VB, …)
 Using different technologies (Web, WPF, …)
 For different platforms (.NET CF, Silverlight, …)
 Full integration of most development activities
(coding, compiling, testing, debugging, deployment,
version control, ...)
 Very easy to use!
37
Benefits of Visual Studio

38
Visual Studio – Example

1. File  New  Project ...
2. Choose C# console application
3. Choose project directory and name
39
Creating New Console Application

4. Visual Studio creates some source code for
you
40
Creating New Console Application (2)
Namespace not
required
Class name
should be
changed
Some imports are
not required

 The process of compiling includes:
 Syntactic checks
 Type safety checks
 Translation of the source code to lower level language
(MSIL)
 Creating of executable files (assemblies)
 You can start compilation by
 Using Build->Build Solution/Project
 Pressing [F6] or [Shift+Ctrl+B]
41
Compiling Source Code

 The process of running application includes:
 Compiling (if project not compiled)
 Starting the application
 You can run application by:
 Using Debug->Start menu
 By pressing [F5] or [Ctrl+F5]
* NOTE: Not all types of projects are able to be started!
42
Running Programs

 The process of application includes:
 Spotting an error
 Finding the lines of code that cause the error
 Fixing the code
 Testing to check if the error is gone and no
errors are introduced
 Iterative and continuous process
43
Debugging The Code

 Visual Studio has built-in debugger
 It provides:
 Breakpoints
 Ability to trace the code execution
 Ability to inspect variables at runtime
44
Debugging in Visual Studio

 // Namespace Declaration
using System;
// Program start class
class WelcomeCSS
{
// Main begins program execution.
static void Main()
{
// Write to console
Console.WriteLine("Welcome to the C# ");
}
}
First program in C# Welcome.cs
Program 1

 The screen will run and close quickly when launching this program To
prevent this add the following code as the last line in the Main method:
 // keep screen from going away // when run from VS.NET
Console.ReadLine();
 You should be aware of is that C# is case-sensitive
 The namespace declaration, using System;, indicates that you are
referencing the System namespace. Namespaces contain groups of code
that can be called upon by C# programs
 The class declaration, class WelcomeCSS, contains the data and method
definitions that your program uses to execute
 The one method within the WelcomeCSS class tells what this class will
do when executed
 Every method must have a return type. In this case it is void, which
means that Main does not return a value. Every method also has a
parameter list following its name with zero or more parameters between
parenthesis. For simplicity, we did not add parameters to Main.
First program in C#

// Namespace Declaration
using System;
// Program start class
class NamedWelcome
{
// Main begins program execution.
static void Main(string[] args)
{
// Write to console
Console.WriteLine("Hello, {0}!", args[0]);
Console.WriteLine("Welcome to the C#");
}
}
Getting Command-Line Input:
NamedWelcome.cs
Program 2

There are 4 ways to define Main function.
We use the simplest one.
static void Main() {...}
static void Main(string[] args) {...}
static int Main() {...}
static int Main(string[] args) {...}
Main Method declaration
C# Beginning

 Variable declarations
 Statements
Inside method Main
static void Main(string[] args)
{
const double pi = 3.1416;
int radius;
double area;
radius = int.Parse(Console.ReadLine());
area = pi*radius*radius;
Console.WriteLine(area);
}
C# Beginning
Program 3

A simple C# Program
Grouping using { }
C# Language Overview
Program 4

A simple C#
Program
Statement ending with semicolon “;”
C# Language Overview
Program 5

Console “Hello World”

A simple C# Program
C# syntax is case-sensitive
namespace NAMEspace
Main() main()
C# Language Overview

A simple C# Program
Anything between /* */ or after // is
considered a comment
static void Main(string[] args) //comment here
{
/* This is comment too. */
Console.WriteLine("Hello World!");
}
Comments will not be translated
C# Language Overview

Dissect The
Program
using System;
class Program
{
public static void Main(string[] args)
{
Random r = new Random();
int answer = 1 + (r.Next() % 100);
int g;
do {
Console.Write("Guess a number: ");
g = int.Parse(Console.ReadLine());
if(g > answer)
Console.WriteLine("Too large");
else if(g < answer)
Console.WriteLine("Too small");
} while(g != answer);
Console.WriteLine("That's correct");
}
}
The main program
is contained in a
function (method)
called Main
Program 6

Every
statement
ends with a ;
(semi-colon)
Program 7
 Variables must
be declared with
proper data
types before
used.
Here, double is a data
type for storing a real
number.

Calculate the
result and store
it in s

Output
Statements
 Input Statement
reads user input
as a string

Install at home:
1. Microsoft .NET Framework
2. Microsoft Visual Studio (or Visual C# Express)
3. Microsoft Developer Network (MSDN)
Familiarize yourself with:
Microsoft Visual Studio
Microsoft Developer Network (MSDN) Library
Documentation
 Find information about Console.WriteLine()
method.
61
Exercises 1
*NOTE: If you have any difficulties, search in Web.

1. Provide a short list with information about the most
popular programming languages. How do they differ
from C#?
2. Describe the difference between C++ and .NET
Framework.
3. Describe briefly .NET Framework. Indicate its key
components?
4. What is Common Language Runtime (CLR)? Why it is
important part of .NET Framework?
5. What is .NET assembly? What are its integral parts?
62
Exercises (2)

6. Create, compile and run a “Hello C#” console application.
7. Modify the application to print your name.
8. Write a program to print the numbers 1, 101 and 1001
9. Create console application that prints your first and last name.
10. Create a console application that prints the current date and
time.
11. Create a console application that calculates and prints the
square of the number 12345.
12. Write a program to read your age from the console and print
how old you will be after 10 years.
Exercises (3)

More Related Content

PDF
Data structure and Alogorithm analysis unit one
PPTX
EE-232-LEC-01 Data_structures.pptx
PPTX
PPTX
data structures and its importance
PPTX
Chapter 1- IT.pptx
PPT
Data structure and algorithm first chapter
PPT
algo 1.ppt
Data structure and Alogorithm analysis unit one
EE-232-LEC-01 Data_structures.pptx
data structures and its importance
Chapter 1- IT.pptx
Data structure and algorithm first chapter
algo 1.ppt

Similar to part 1 - intorduction data structure 2021 mte.ppt (20)

PPTX
Chapter two data structure and algorthms.pptx
PPTX
data structure and algoriythm pres.pptxD
DOCX
Algorithms and Data Structures~hmftj
PPTX
8.unit-1-fds-2022-23.pptx
PPTX
DSA - Lesson 1 INtroduction to database.pptx
PDF
MCA_Data Structure_Notes_of_UNIT_I & II.pdf
PPTX
Data Structure.pptx
PPT
assignment character education assignment
PPTX
Unit 1 Introduction Part 3.pptx
PPTX
Lecture 1.pptx
PDF
Data structures and algorithms Module-1.pdf
PDF
Chapter 1 Introduction to Data Structures and Algorithms.pdf
PPTX
datastructuresandalgorithm-module1-230307012644-4c895c84.pptx
PDF
Unit I Data structure and algorithms notes
PPTX
Data Structures and Algorithm - Module 1.pptx
PDF
PPTX
Introduction to databae eChapter 1-.pptx
PPTX
DSA - Lesson 1-1Introductio to data struct.pptx
DOCX
3rd-Sem_CSE_Data-Structures and Applications.docx
PPT
DATA STRUCTURE AND ALGORITHMS
Chapter two data structure and algorthms.pptx
data structure and algoriythm pres.pptxD
Algorithms and Data Structures~hmftj
8.unit-1-fds-2022-23.pptx
DSA - Lesson 1 INtroduction to database.pptx
MCA_Data Structure_Notes_of_UNIT_I & II.pdf
Data Structure.pptx
assignment character education assignment
Unit 1 Introduction Part 3.pptx
Lecture 1.pptx
Data structures and algorithms Module-1.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
datastructuresandalgorithm-module1-230307012644-4c895c84.pptx
Unit I Data structure and algorithms notes
Data Structures and Algorithm - Module 1.pptx
Introduction to databae eChapter 1-.pptx
DSA - Lesson 1-1Introductio to data struct.pptx
3rd-Sem_CSE_Data-Structures and Applications.docx
DATA STRUCTURE AND ALGORITHMS

Recently uploaded (20)

PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
Fluorescence-microscope_Botany_detailed content
PPT
ISS -ESG Data flows What is ESG and HowHow
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PPTX
Computer network topology notes for revision
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
1_Introduction to advance data techniques.pptx
PDF
Foundation of Data Science unit number two notes
PDF
annual-report-2024-2025 original latest.
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Fluorescence-microscope_Botany_detailed content
ISS -ESG Data flows What is ESG and HowHow
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Clinical guidelines as a resource for EBP(1).pdf
Miokarditis (Inflamasi pada Otot Jantung)
Computer network topology notes for revision
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
.pdf is not working space design for the following data for the following dat...
1_Introduction to advance data techniques.pptx
Foundation of Data Science unit number two notes
annual-report-2024-2025 original latest.
oil_refinery_comprehensive_20250804084928 (1).pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
STUDY DESIGN details- Lt Col Maksud (21).pptx
Business Ppt On Nestle.pptx huunnnhhgfvu
Galatica Smart Energy Infrastructure Startup Pitch Deck

part 1 - intorduction data structure 2021 mte.ppt

  • 2.  Our Course contains 6 main parts: 2/64  Part 1- Introduction to Data Structure and Algorithm  Part 2 – Array Data Structure  Part 3- List Data Structure  Part 4 –Stack And Queue Data Structure  Part 5 – Tree and Table Data Structure.  Part 6 – Algorithm (Sort and search )
  • 3.  Course Objective The main objective of this course is to provide students with the theoretical background and practical experience relating to the design and implementation of Data structure. The main objectives of the course are: (1) Know the terminology associated with the Data structure field.  Data Structures Course Objectives  Be familiar with basic techniques of algorithm analysis  Master the implementation of linked data structures such as linked lists and binary trees  Be familiar with several sorting algorithms including quicksort, mergesort  Be familiar with path and minimum spanning tree  Master the standard data structure library of a major programming language (e.g. C#) 3
  • 4.   Be able to classify data structures and algorithms as “good/bad”.  Know precise ways of analyzing whether a data structure or algorithm is good. Course Objectives 4
  • 5.  Overall Picture Data Structure and Algorithm Design Goals Implementation Goals Correctness Efficiency Robustness Adaptability Reusability
  • 6.  This course is not about:  Programming languages  Computer architecture  Software architecture  Software design and implementation principles  Issues concerning small and large scale programming  We will only touch upon the theory of complexity and computability 6 Overall Picture (2)
  • 7.  Weekly Periodical sheets to assess understanding each chapter or terminated job Report : to assess gain of specific chapter and task Participation in the lecture to assess gain of specific chapter and task Lab activities to assess implementation of the practical parts Term project to assess understanding how to complete job Mid term and final Exam Assessment Methods 20% for and Projects and lab Activities 15 % for and lecture activities and attendance, Quizzes, report, project 15 % for midterm exam 50 % final exam 7
  • 8.   A: 91-100  A-: 89, 90  B: 79 - 88  C: 70 - 78  D: 59 - 69  F: 0 - 58 Grade scale For a grade of C or better you must have both: •At least 300 points from all programming assignments •At least 300 points from exams 8
  • 9.  Notes  Lecture attendance is very important. You lose ½ degree for each lecture you miss.  Late submission of the tasks will be marked with deduction of %10 per day.  The assignments, and of course the quizzes, and exams need to be done individually  Students have to attend Exams or lecture on time – No Excuse are accepted. 9
  • 10.   All assignment are individual  Plagiarism is not tolerated/ FSU Honor code strictly enforced (see details in syllabus).  Automated detection tools will be employed!  Typically two weeks per-assignment  Start early  Ask questions early  Submit on time  Lateness policy (after 11:59PM on Fridays):  10% penalty < 24 hours delay  20% penalty < 48 hours delay  No points awarded > 48 hours delay, except in special cases with documented reasons Assignments 10
  • 13.  Design Produce Measurement/ Analysis Reporting 3D Cad Model Authority Process Scope Computer in Industrial Life
  • 15.  2D Drawing Authority 2D Drawing Interpretation Digital Product Line Today 3D Design 3D Model Release Tool Oriented Detail Assembly 2D drawing Assembly Inspection 3D Measurement Equipment MFG Engineering NC Programming Manufacturing Quality Assurance Tooling Product Integrated Digital Product Line 3D Model Assembly Inspection 3d Model Oriented Detail Assembly And Authority
  • 17.  Overview of 3D Measurement Pilot Create 3D CAD Models of components, sub-assemblies and major components CATIA Model with Embedded Tolerancing Local Area/Zone X-form from Part Attributes Key Characteristics FD&T Tolerances Measurement Systems
  • 18.  Functional Dimensioning and Tolerancing (FDT)
  • 21.  21 Define: Computer Program • Series of instructions submitted to a computer to accomplish a task- Instructions must be written in a way the computer can understand • An organized list of instructions that, when executed, causes the computer to behave in a predetermined manner. • A program contains a list of values (called variables) and a list of directions (called statements) that tell the computer what to do with the variables. • The variables can represent numeric data, text, can be organized (structured) in different way
  • 22.  Data Structure  Systematic way of organizing and accessing data.  are collection of variables, possibly of several different data types, connected in various ways.  A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Algorithm  Step-by-step procedure for performing some task in a finite amount of time. Definitions
  • 23.   A Set of Instructions  Data Structures + Algorithms  Data Structure = A Container stores Data  Algoirthm = Logic + Control What is Program
  • 24.   Formal data structures enable a programmer to mentally structure large amounts of data into conceptually manageable relationships  Sometimes we use data structures to allow us to do more: for example, to accomplish fast searching or sorting of data.  we can call the data structure an abstract data type (sometimes abbreviated as ADT). Abstract data types can minimize dependencies in your code Benefit of Data Structure
  • 25.   Algorithm  Outline, the essence of a computational procedure, step-by-step instructions  Program – an implementation of an algorithm in some programming language  Data structure  Organization of data needed to solve the problem 25 Data Structures and Algorithms
  • 26.   In programming, the term data structure refers to a scheme for organizing related pieces of information. The basic types of data structures include: Array lists Stack Queue Tree Table Data structure and programming
  • 27.   Abstract Data Type (ADT)  A set of allowed data values, with a set of allowed operations.  Allows the user to create data types to their own specifications  All data must conform to the predefined structure, and this data may only be manipulated through a set of predefined operations.  These operations must not violate the integrity of the data structure.  The purpose of the ADT is to shield the programmer from the internal workings of the data structure, by giving access to the data only through the operations. Definitions
  • 28.  Has zero or more inputs. Has at least 1 output. Each instruction is unambiguous. Terminates after a finite sequence of instructions. Each step is achievable. Properties of an Algorithm
  • 29.   design the algorithm  goals:  correctness  efficiency  verify and prove correctness  goals:  will it work for all cases?  does it output the correct result? Developing Algorithms
  • 30.   analyze the algorithm  goals:  how long will it run?  at what instance will it fail? Succeed?  rate of change of execution as data size increases?  implement the algorithm  coding and programming  goals:  robustness – ability to handle unexpected inputs  adaptability – ability to run with less changes in hardware & operating system platforms  reusability – use as diff component of other system for various Developing Algorithms (cont.)
  • 31.   determine the running time of a program as a function of its inputs;  determine the total or maximum memory space needed for program data;  determine the total size of the program code;  determine whether the program correctly computes the desired result; Analysis of an Algorithm determine the complexity of the program • how easy it is to read, understand, and modify determine the robustness of the program • how well does it deal with unexpected or erroneous inputs?
  • 32.   algorithm itself  input data  computer system used to run the program Factors that Affect Running Time hardware processor used (type and speed); memory available (cache and RAM) , and disk available the programming language in which the system is specified; the language compiler/interpreter used; and the computer operating system software
  • 33.   Knowledge of a programming language  C#  Task to solve  Development environment, compilers, SDK  Visual Studio, .NET Framework SDK  Set of useful standard classes  Microsoft .NET Framework FCL  Help documentation  MSDN Library 33 What You Need to Program?
  • 34.   Programming language A syntax that allow to give instructions to the computer  C# features: New cutting edge language Extremely powerful Easy to learn Easy to read and understand Object-oriented 34 What is "C#"?
  • 36.   Visual Studio – Integrated Development Environment (IDE)  Development tool that helps us to:  Write code  Design user interface  Compile code  Execute / test / debug applications  Browse the help  Manage project's files 36 Visual Studio
  • 37.   Single tool for:  Writing code in many languages (C#, VB, …)  Using different technologies (Web, WPF, …)  For different platforms (.NET CF, Silverlight, …)  Full integration of most development activities (coding, compiling, testing, debugging, deployment, version control, ...)  Very easy to use! 37 Benefits of Visual Studio
  • 39.  1. File  New  Project ... 2. Choose C# console application 3. Choose project directory and name 39 Creating New Console Application
  • 40.  4. Visual Studio creates some source code for you 40 Creating New Console Application (2) Namespace not required Class name should be changed Some imports are not required
  • 41.   The process of compiling includes:  Syntactic checks  Type safety checks  Translation of the source code to lower level language (MSIL)  Creating of executable files (assemblies)  You can start compilation by  Using Build->Build Solution/Project  Pressing [F6] or [Shift+Ctrl+B] 41 Compiling Source Code
  • 42.   The process of running application includes:  Compiling (if project not compiled)  Starting the application  You can run application by:  Using Debug->Start menu  By pressing [F5] or [Ctrl+F5] * NOTE: Not all types of projects are able to be started! 42 Running Programs
  • 43.   The process of application includes:  Spotting an error  Finding the lines of code that cause the error  Fixing the code  Testing to check if the error is gone and no errors are introduced  Iterative and continuous process 43 Debugging The Code
  • 44.   Visual Studio has built-in debugger  It provides:  Breakpoints  Ability to trace the code execution  Ability to inspect variables at runtime 44 Debugging in Visual Studio
  • 45.   // Namespace Declaration using System; // Program start class class WelcomeCSS { // Main begins program execution. static void Main() { // Write to console Console.WriteLine("Welcome to the C# "); } } First program in C# Welcome.cs Program 1
  • 46.   The screen will run and close quickly when launching this program To prevent this add the following code as the last line in the Main method:  // keep screen from going away // when run from VS.NET Console.ReadLine();  You should be aware of is that C# is case-sensitive  The namespace declaration, using System;, indicates that you are referencing the System namespace. Namespaces contain groups of code that can be called upon by C# programs  The class declaration, class WelcomeCSS, contains the data and method definitions that your program uses to execute  The one method within the WelcomeCSS class tells what this class will do when executed  Every method must have a return type. In this case it is void, which means that Main does not return a value. Every method also has a parameter list following its name with zero or more parameters between parenthesis. For simplicity, we did not add parameters to Main. First program in C#
  • 47.  // Namespace Declaration using System; // Program start class class NamedWelcome { // Main begins program execution. static void Main(string[] args) { // Write to console Console.WriteLine("Hello, {0}!", args[0]); Console.WriteLine("Welcome to the C#"); } } Getting Command-Line Input: NamedWelcome.cs Program 2
  • 48.  There are 4 ways to define Main function. We use the simplest one. static void Main() {...} static void Main(string[] args) {...} static int Main() {...} static int Main(string[] args) {...} Main Method declaration C# Beginning
  • 49.   Variable declarations  Statements Inside method Main static void Main(string[] args) { const double pi = 3.1416; int radius; double area; radius = int.Parse(Console.ReadLine()); area = pi*radius*radius; Console.WriteLine(area); } C# Beginning Program 3
  • 50.  A simple C# Program Grouping using { } C# Language Overview Program 4
  • 51.  A simple C# Program Statement ending with semicolon “;” C# Language Overview Program 5
  • 53.  A simple C# Program C# syntax is case-sensitive namespace NAMEspace Main() main() C# Language Overview
  • 54.  A simple C# Program Anything between /* */ or after // is considered a comment static void Main(string[] args) //comment here { /* This is comment too. */ Console.WriteLine("Hello World!"); } Comments will not be translated C# Language Overview
  • 55.  Dissect The Program using System; class Program { public static void Main(string[] args) { Random r = new Random(); int answer = 1 + (r.Next() % 100); int g; do { Console.Write("Guess a number: "); g = int.Parse(Console.ReadLine()); if(g > answer) Console.WriteLine("Too large"); else if(g < answer) Console.WriteLine("Too small"); } while(g != answer); Console.WriteLine("That's correct"); } } The main program is contained in a function (method) called Main Program 6
  • 56.  Every statement ends with a ; (semi-colon) Program 7
  • 57.  Variables must be declared with proper data types before used. Here, double is a data type for storing a real number.
  • 60.  Input Statement reads user input as a string
  • 61.  Install at home: 1. Microsoft .NET Framework 2. Microsoft Visual Studio (or Visual C# Express) 3. Microsoft Developer Network (MSDN) Familiarize yourself with: Microsoft Visual Studio Microsoft Developer Network (MSDN) Library Documentation  Find information about Console.WriteLine() method. 61 Exercises 1 *NOTE: If you have any difficulties, search in Web.
  • 62.  1. Provide a short list with information about the most popular programming languages. How do they differ from C#? 2. Describe the difference between C++ and .NET Framework. 3. Describe briefly .NET Framework. Indicate its key components? 4. What is Common Language Runtime (CLR)? Why it is important part of .NET Framework? 5. What is .NET assembly? What are its integral parts? 62 Exercises (2)
  • 63.  6. Create, compile and run a “Hello C#” console application. 7. Modify the application to print your name. 8. Write a program to print the numbers 1, 101 and 1001 9. Create console application that prints your first and last name. 10. Create a console application that prints the current date and time. 11. Create a console application that calculates and prints the square of the number 12345. 12. Write a program to read your age from the console and print how old you will be after 10 years. Exercises (3)