SlideShare a Scribd company logo
Algorithms & Data Structures
Ust Khalid Bana(banajibreel111@gmail.com)
Structure of a program in Java
Probably the best way to start learning a programming
language is by writing a program. Therefore, here is our
first program:
// my first program in java
package my_program
Public class main
{
Public static void main(String[]args){
Ssytem.out.print(“I am going to Use data Structure”);
}}
I am going to Use data Structure
‫النتيج‬‫ة‬
‫السابق‬ ‫الكود‬ ‫شرح‬
// my first program in
java
 This is a comment line
 All lines beginning with two slash signs (//)
 description of what our program is
Public static void main ()
The main function is the point by where all
programs start their execution
System.out.print(" I am going to Use data
Structure “);
cout represents the standard output
Variables
 a = 5;
 b = 2;
 a = a + 1;
 result = a - b;
Declaration of variables ‫المتغيرات‬ ‫عن‬ ‫االعالن‬
Type Name of Variable = Value
‫المتغير‬ ‫نوع‬ ‫المتغير‬ ‫اسم‬ ‫المتغير‬ ‫قيمة‬
‫المتغيرات‬:‫معين‬ ‫حجم‬ ‫لها‬ ‫حاويات‬ ‫عن‬ ‫عبارة‬ ‫هي‬(‫حجم‬ ‫له‬ ‫نوع‬ ‫كل‬)
‫البيانات‬ ‫بتخزين‬ ‫تقوم‬,‫لبر‬ ‫واليمكن‬ ‫البرمجة‬ ‫أساسيات‬ ‫من‬ ‫تعد‬‫أن‬ ‫نامج‬
‫دونها‬ ‫من‬ ‫يعمل‬,‫في‬ ‫له‬ ‫مخصص‬ ‫حجم‬ ‫نوع‬ ‫لكل‬ ‫انواع‬ ‫عدة‬ ‫من‬ ‫تتكون‬
‫الذاكرة‬,‫الصحيح‬ ‫النوع‬ ‫من‬ ‫متغيرات‬ ‫مثل‬int‫النوع‬ ‫من‬ ‫ومتغيرات‬
‫النصي‬string,char‫الخ‬.

‫تعريف‬‫مبسط‬‫للمتغيرات‬:‫أسماء‬ ‫هي‬(‫عناوين‬)‫ذ‬ ‫في‬ ‫لمواقع‬‫اكرة‬
‫أو‬ ‫رموز‬ ‫بها‬ ‫يخزن‬ ، ‫الحاسوب‬‫أعداد‬.
‫المتغيرات‬ ‫تعريف‬
 int a ;
 float mynumber ;
 int a, b, c ;
o int a;
o int b;
o int c;
Examples :
Control Structures
Conditional structure: if and else
if (condition) statement
Sysntax 1 :
Where condition is the expression that is being
evaluated. If this condition is true, statement is
executed. If it is false, statement is ignored (not
executed)
For example
if ( grade >= 60 )
System.out.println( "Passed" );
If we want more than a single statement to be executed in
case that the condition is true we can specify a block
using braces { }:
if ( grade >= 60 ){
System.out.println( "Passed"
);
}
if (condition) statement1 else statement2
Sysntax 2 :
if ( grade >= 60 )
System.out.println( "Passed" );
else
System.out.println( "Failed" );
For example
For example
while ( )
{
grade = input.nextInt();
total += grade;
++gradeCounter;
incrementLetterGradeCounter( grade );
}
}
The do-while loop
Sysntax :
do statement while (condition);
public static void main( String[] args )
{
int counter = 1;
do{
System.out.print(counter);
++counter
}while(counter<=10);
System.out.print();
}
For example
The for loop
Sysntax :
for (initialization; condition; increase) statement;
// countdown using a for loop
Public static void main (String[]args)
{
for (int n=10; n>0; n--) {
System.ut.print(n)
}
System.out.print ( "FIRE!n“);
}}
For example
Search
(2)
 Jump statements + switch + elseif
 The break statement
 The continue statement
 The goto statement
Functions
A function is a group of statements that is executed
when it is called from some point of the program
‫معين‬ ‫عمل‬ ‫يؤدي‬ ‫برمجي‬ ‫مقطع‬ ‫عن‬ ‫عبارة‬ ‫هي‬ ‫بساطة‬ ‫وبكل‬ ‫الدالة‬
‫المقطع‬ ‫هذا‬ ‫تنفيذ‬ ‫ويتم‬‫الدالة‬ ‫استدعاء‬ ‫خالل‬ ‫من‬‫ال‬ ‫تستدعي‬ ‫حيث‬‫دالة‬
‫االسم‬ ‫خالل‬ ‫من‬(‫الدالة‬ ‫اسم‬ ‫اي‬.)
Functions cont….
‫؟‬ ‫الدوال‬ ‫نستخدم‬ ‫لماذا‬
.1‫الكبيرة‬ ‫البرامج‬ ‫كتابة‬ ‫لتسهيل‬.
.2‫االخطاء‬ ‫تتبع‬ ‫سهولة‬.
.3‫وتطوير‬ ‫التعديل‬ ‫سهولة‬‫البرنامج‬‫كامال‬ ‫البرنامج‬ ‫كتابة‬ ‫الي‬ ‫الحاجة‬ ‫دون‬.
.4‫صغير‬ ‫البرنامج‬ ‫حجم‬ ‫جعل‬.
Sysntax :
type name ( parameter1, parameter2, ...)
{
statements
Return value
}
For example
‫الدوال‬ ‫مفهوم‬ ‫استخدام‬ ‫دون‬ ‫عددين‬ ‫وطرح‬ ‫بجمع‬ ‫يقوم‬ ‫برنامج‬
For example
‫عددين‬ ‫وطرح‬ ‫بجمع‬ ‫يقوم‬ ‫برنامج‬‫بإستخدام‬‫الدوال‬ ‫مفهوم‬
END

More Related Content

PDF
Rules Engine - java(Drools) & ruby(ruleby)
PPTX
Drools Ecosystem
PPTX
Drools
PPT
Database Triggers
PPT
Trigger
PPT
Droolsand Rule Based Systems 2008 Srping
ODP
Drools BeJUG 2010
ODP
Drools & jBPM Info Sheet
Rules Engine - java(Drools) & ruby(ruleby)
Drools Ecosystem
Drools
Database Triggers
Trigger
Droolsand Rule Based Systems 2008 Srping
Drools BeJUG 2010
Drools & jBPM Info Sheet

What's hot (20)

DOCX
บทที่3
ODP
Smidige databaser
PDF
Introducing Drools
PDF
PLSQL Note
PPT
Java threading 2
PDF
React new features and intro to Hooks
PDF
Testing orm based code
PDF
Triggers and active database
PPTX
Reactive programming with RxAndroid
PDF
Solid scala
PDF
PDF
Rules Programming tutorial
PPTX
MySql Triggers Tutorial - The Webs Academy
PPTX
Ensure code quality with vs2012
PDF
Detecting Broken Pointcuts using Structural Commonality and Degree of Interest
PDF
Fraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
PDF
Magic methods
PPTX
Rule Engine: Drools .Net
บทที่3
Smidige databaser
Introducing Drools
PLSQL Note
Java threading 2
React new features and intro to Hooks
Testing orm based code
Triggers and active database
Reactive programming with RxAndroid
Solid scala
Rules Programming tutorial
MySql Triggers Tutorial - The Webs Academy
Ensure code quality with vs2012
Detecting Broken Pointcuts using Structural Commonality and Degree of Interest
Fraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
Magic methods
Rule Engine: Drools .Net
Ad

Similar to Data structures (20)

PPTX
Control Structures in Java with computer codes
PPTX
PPTX
PDF
java notes.pdf
PPTX
130706266060138191
PPTX
Java Foundations: Basic Syntax, Conditions, Loops
PPT
Control statements
PPTX
Control structures
PPTX
Java basics and java variables
PPTX
JAVA programming language made easy.pptx
PPT
Chapter 4 flow control structures and arrays
PPTX
Java chapter 3
PPT
Control statements
PPTX
Java Programming
PPTX
JPC#8 Introduction to Java Programming
PPTX
Computer science principals in terms of Programming
PPTX
control statements
PPT
Chapter 1 nested control structures
PPTX
Core Java Tutorials by Mahika Tutorials
PPT
4 programming-using-java intro-tojava20102011
Control Structures in Java with computer codes
java notes.pdf
130706266060138191
Java Foundations: Basic Syntax, Conditions, Loops
Control statements
Control structures
Java basics and java variables
JAVA programming language made easy.pptx
Chapter 4 flow control structures and arrays
Java chapter 3
Control statements
Java Programming
JPC#8 Introduction to Java Programming
Computer science principals in terms of Programming
control statements
Chapter 1 nested control structures
Core Java Tutorials by Mahika Tutorials
4 programming-using-java intro-tojava20102011
Ad

Recently uploaded (20)

PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
top salesforce developer skills in 2025.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administration Chapter 2
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Introduction to Artificial Intelligence
PPT
Introduction Database Management System for Course Database
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Digital Strategies for Manufacturing Companies
PPTX
assetexplorer- product-overview - presentation
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
top salesforce developer skills in 2025.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
VVF-Customer-Presentation2025-Ver1.9.pptx
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Transform Your Business with a Software ERP System
System and Network Administration Chapter 2
2025 Textile ERP Trends: SAP, Odoo & Oracle
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Which alternative to Crystal Reports is best for small or large businesses.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Upgrade and Innovation Strategies for SAP ERP Customers
Wondershare Filmora 15 Crack With Activation Key [2025
Introduction to Artificial Intelligence
Introduction Database Management System for Course Database
How to Migrate SBCGlobal Email to Yahoo Easily
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Digital Strategies for Manufacturing Companies
assetexplorer- product-overview - presentation

Data structures

  • 1. Algorithms & Data Structures Ust Khalid Bana(banajibreel111@gmail.com)
  • 2. Structure of a program in Java Probably the best way to start learning a programming language is by writing a program. Therefore, here is our first program:
  • 3. // my first program in java package my_program Public class main { Public static void main(String[]args){ Ssytem.out.print(“I am going to Use data Structure”); }} I am going to Use data Structure ‫النتيج‬‫ة‬
  • 4. ‫السابق‬ ‫الكود‬ ‫شرح‬ // my first program in java  This is a comment line  All lines beginning with two slash signs (//)  description of what our program is
  • 5. Public static void main () The main function is the point by where all programs start their execution System.out.print(" I am going to Use data Structure “); cout represents the standard output
  • 6. Variables  a = 5;  b = 2;  a = a + 1;  result = a - b;
  • 7. Declaration of variables ‫المتغيرات‬ ‫عن‬ ‫االعالن‬ Type Name of Variable = Value ‫المتغير‬ ‫نوع‬ ‫المتغير‬ ‫اسم‬ ‫المتغير‬ ‫قيمة‬
  • 8. ‫المتغيرات‬:‫معين‬ ‫حجم‬ ‫لها‬ ‫حاويات‬ ‫عن‬ ‫عبارة‬ ‫هي‬(‫حجم‬ ‫له‬ ‫نوع‬ ‫كل‬) ‫البيانات‬ ‫بتخزين‬ ‫تقوم‬,‫لبر‬ ‫واليمكن‬ ‫البرمجة‬ ‫أساسيات‬ ‫من‬ ‫تعد‬‫أن‬ ‫نامج‬ ‫دونها‬ ‫من‬ ‫يعمل‬,‫في‬ ‫له‬ ‫مخصص‬ ‫حجم‬ ‫نوع‬ ‫لكل‬ ‫انواع‬ ‫عدة‬ ‫من‬ ‫تتكون‬ ‫الذاكرة‬,‫الصحيح‬ ‫النوع‬ ‫من‬ ‫متغيرات‬ ‫مثل‬int‫النوع‬ ‫من‬ ‫ومتغيرات‬ ‫النصي‬string,char‫الخ‬.  ‫تعريف‬‫مبسط‬‫للمتغيرات‬:‫أسماء‬ ‫هي‬(‫عناوين‬)‫ذ‬ ‫في‬ ‫لمواقع‬‫اكرة‬ ‫أو‬ ‫رموز‬ ‫بها‬ ‫يخزن‬ ، ‫الحاسوب‬‫أعداد‬. ‫المتغيرات‬ ‫تعريف‬
  • 9.  int a ;  float mynumber ;  int a, b, c ; o int a; o int b; o int c; Examples :
  • 10. Control Structures Conditional structure: if and else if (condition) statement Sysntax 1 :
  • 11. Where condition is the expression that is being evaluated. If this condition is true, statement is executed. If it is false, statement is ignored (not executed) For example if ( grade >= 60 ) System.out.println( "Passed" );
  • 12. If we want more than a single statement to be executed in case that the condition is true we can specify a block using braces { }: if ( grade >= 60 ){ System.out.println( "Passed" ); }
  • 13. if (condition) statement1 else statement2 Sysntax 2 : if ( grade >= 60 ) System.out.println( "Passed" ); else System.out.println( "Failed" ); For example
  • 14. For example while ( ) { grade = input.nextInt(); total += grade; ++gradeCounter; incrementLetterGradeCounter( grade ); } }
  • 15. The do-while loop Sysntax : do statement while (condition);
  • 16. public static void main( String[] args ) { int counter = 1; do{ System.out.print(counter); ++counter }while(counter<=10); System.out.print(); } For example
  • 17. The for loop Sysntax : for (initialization; condition; increase) statement;
  • 18. // countdown using a for loop Public static void main (String[]args) { for (int n=10; n>0; n--) { System.ut.print(n) } System.out.print ( "FIRE!n“); }} For example
  • 19. Search (2)  Jump statements + switch + elseif  The break statement  The continue statement  The goto statement
  • 20. Functions A function is a group of statements that is executed when it is called from some point of the program
  • 21. ‫معين‬ ‫عمل‬ ‫يؤدي‬ ‫برمجي‬ ‫مقطع‬ ‫عن‬ ‫عبارة‬ ‫هي‬ ‫بساطة‬ ‫وبكل‬ ‫الدالة‬ ‫المقطع‬ ‫هذا‬ ‫تنفيذ‬ ‫ويتم‬‫الدالة‬ ‫استدعاء‬ ‫خالل‬ ‫من‬‫ال‬ ‫تستدعي‬ ‫حيث‬‫دالة‬ ‫االسم‬ ‫خالل‬ ‫من‬(‫الدالة‬ ‫اسم‬ ‫اي‬.) Functions cont….
  • 22. ‫؟‬ ‫الدوال‬ ‫نستخدم‬ ‫لماذا‬ .1‫الكبيرة‬ ‫البرامج‬ ‫كتابة‬ ‫لتسهيل‬. .2‫االخطاء‬ ‫تتبع‬ ‫سهولة‬. .3‫وتطوير‬ ‫التعديل‬ ‫سهولة‬‫البرنامج‬‫كامال‬ ‫البرنامج‬ ‫كتابة‬ ‫الي‬ ‫الحاجة‬ ‫دون‬. .4‫صغير‬ ‫البرنامج‬ ‫حجم‬ ‫جعل‬.
  • 23. Sysntax : type name ( parameter1, parameter2, ...) { statements Return value }
  • 24. For example ‫الدوال‬ ‫مفهوم‬ ‫استخدام‬ ‫دون‬ ‫عددين‬ ‫وطرح‬ ‫بجمع‬ ‫يقوم‬ ‫برنامج‬
  • 25. For example ‫عددين‬ ‫وطرح‬ ‫بجمع‬ ‫يقوم‬ ‫برنامج‬‫بإستخدام‬‫الدوال‬ ‫مفهوم‬
  • 26. END