الخوارزميات
مجموعة من التراكيب الرياضية والمنطقية والتي في النهاية تهدف لحل مشكل أو تحسين الأداء لمنتج أو طريقة المعالجة، الخوارزميات في علم الحاسوب هي مجموعة من التعليمات الواضحة التي يتم تنفيذها واحدة تلو الآخرى لحل مشكلة ما، واللفظ نسبة لعالم الرياضيات محمد بن موسى الخوارزمي.
الدورة التدريبية الاولة لورشة عمل منهج الحاسوب الجديد
فكان التعلم النشط والطريقة الخماسية في التعلم من ضمن مفردات الدورة الاساسية
محمود احمد الراشد
شكرا لمشاهدتكم
This document discusses repetition statements in Java, including while, for, and do-while loops. It provides examples of using each loop type, such as calculating the average of test grades in a class and summing even integers. The break and continue statements are also covered, along with examples of how they alter loop flow. Key aspects of counter-controlled repetition like loop counters, initialization, increment/decrement, and continuation conditions are defined.
More Related Content
Similar to Chapter 2: array and array list data structure (20)
الخوارزميات
مجموعة من التراكيب الرياضية والمنطقية والتي في النهاية تهدف لحل مشكل أو تحسين الأداء لمنتج أو طريقة المعالجة، الخوارزميات في علم الحاسوب هي مجموعة من التعليمات الواضحة التي يتم تنفيذها واحدة تلو الآخرى لحل مشكلة ما، واللفظ نسبة لعالم الرياضيات محمد بن موسى الخوارزمي.
الدورة التدريبية الاولة لورشة عمل منهج الحاسوب الجديد
فكان التعلم النشط والطريقة الخماسية في التعلم من ضمن مفردات الدورة الاساسية
محمود احمد الراشد
شكرا لمشاهدتكم
This document discusses repetition statements in Java, including while, for, and do-while loops. It provides examples of using each loop type, such as calculating the average of test grades in a class and summing even integers. The break and continue statements are also covered, along with examples of how they alter loop flow. Key aspects of counter-controlled repetition like loop counters, initialization, increment/decrement, and continuation conditions are defined.
This document provides an outline and overview of hashing and hash tables. It defines hashing as a technique for storing data to allow for fast insertion, retrieval, and deletion. A hash table uses an array and hash function to map keys to array indices. Collision resolution techniques like linear probing are discussed. The document also summarizes the Hashtable class in .NET, which uses buckets and load factor to avoid collisions. Examples of hash functions and using the Hashtable class are provided.
This document discusses graphs and their representation in code. It defines graphs as consisting of vertices and edges, with edges specified as pairs of vertices. It distinguishes between directed and undirected graphs. Key graph terms like paths, cycles, and connectivity are defined. Real-world systems that can be modeled as graphs are given as an example. The document then discusses representing vertices and edges in code, choosing an adjacency matrix to represent the edges in the graph.
The document discusses trees and binary trees as data structures. It defines what a tree is, including parts like the root, parent, child, leaf nodes. It then defines binary trees as trees where each node has no more than two children. Binary search trees are introduced as binary trees where all left descendants of a node are less than or equal to the node and all right descendants are greater. The document concludes by discussing how to build a binary search tree class with Node objects.
This document provides an outline and overview of the queue data structure. It defines a queue as a first-in, first-out (FIFO) structure where new items are added to the rear of the queue and items are removed from the front. The key queue operations of enqueue and dequeue are described. Code examples are provided for implementing a queue using a linked list structure with classes for the queue, its nodes, and methods for common queue operations like enqueue, dequeue, peek, clear, print, and search. Different types of queues like linear, circular, and double-ended queues are also mentioned.
The document provides an overview of stack data structures, including definitions and examples. It discusses key stack operations like push, pop, peek, clear, print all, and search. Code examples are given for an Employee class and Stack class implementation to demonstrate how these operations work on a stack of employee objects. The document aims to teach the fundamentals of stack data structures and provide code samples to practice stack operations.
This document provides an outline and overview of linked lists. It defines a linked list as a collection of nodes that are linked together by references to the next node. Each node contains a data field and a reference field. It describes how to implement a linked list using a self-referential class with fields for data and a reference to the next node. It then outlines common linked list operations like insertion and deletion at different positions as well as sorting and searching the linked list.
Chapter 4: basic search algorithms data structureMahmoud Alfarra
1) The document discusses two common search algorithms: sequential search and binary search. Sequential search looks at each item in a list sequentially until the target is found. Binary search works on a sorted list and divides the search space in half at each step.
2) It provides pseudocode examples of how each algorithm works step-by-step to find a target value in a list or array.
3) Binary search is more efficient than sequential search when the list is sorted, as it can significantly reduce the number of comparisons needed to find the target. Sequential search is used when the list is unsorted.
Chapter 3: basic sorting algorithms data structureMahmoud Alfarra
The document provides an outline and introduction for a chapter on basic sorting algorithms, including bubble sort, selection sort, and insertion sort algorithms. It includes pseudocode examples and explanations of each algorithm. It notes that bubble sort is one of the slowest but simplest algorithms, involving values "floating" to their correct positions. Selection sort finds the smallest element and places it in the first position, then repeats to find the next smallest. Insertion sort works by moving larger elements to the right to make room for smaller elements inserted from the left.
This document is a presentation on data structures in C# by Mr. Mahmoud R. Alfarra. It introduces C# and its uses in different applications. It covers various data types in C#, calculations and logical operations, control statements like if/else and loops. The document also discusses arrays, methods, and classes in C#. It provides examples to explain concepts like selection statements, iteration, and calling methods. The presentation aims to provide an introduction to the principles of C# for learning purposes.
This document provides an introduction and outline for a course on data structures. It introduces the lecturer, Mahmoud Rafeek Alfarra, and lists his qualifications. It outlines the course objectives, resources, guidelines, assessment, and schedule. Key topics that will be covered include arrays, sorting and searching algorithms, linked lists, stacks, queues, trees and graphs. The document provides classifications of different types of data structures such as linear vs nonlinear, static vs dynamic memory allocation. It concludes with information about how students can be successful in the course.
Definition of classification
Basic principles of classification
Typical
How Does Classification Works?
Difference between Classification & Prediction.
Machine learning techniques
Decision Trees
k-Nearest Neighbors
This document is a lecture on decision making practices in Java. It identifies errors in code snippets involving if/else statements and while loops. It also contains examples to trace code with variables and determine output based on variable values. The document is in Arabic and English and presented by Mahmoud R. Alfarra on using Java and correcting errors in code involving conditional and iterative structures.
This document discusses selection statements in Java including if-else statements, nested if-else statements, blocks, and switch statements. It provides examples of using these statements to check conditions, compare values, and select different code paths. It also assigns practice problems for students to write programs using selection statements to check grades, login credentials, and print days of the week.
This document provides an introduction to object-oriented programming concepts like classes, objects, and methods in Java. It defines classes as templates that define attributes and behaviors of objects as variables and methods. Objects are instances of classes. The document explains how to declare a class with access modifiers, variables, constructors, and methods. It also demonstrates how to create objects using the new keyword and access object attributes and methods.
What is a computer?
Computer Organization
Programming languages
Java Class Libraries
Typical Java development environment
Case Study: Unified Modeling Language
2 programming-using-java how to built applicationMahmoud Alfarra
This document discusses key concepts in programming using Java, including:
1. The programming life cycle consists of five stages: thinking, planning, designing, coding, and testing.
2. Algorithms can be represented through pseudo code and flow charts to document solutions before coding.
3. Several examples of algorithms are provided to calculate averages, check conditions, and iterate through loops.
نظام سداد الرسوم والتحصيلات العامه الحكومية Zakat_App_Presentation.pptxmohmedalgathy
Ad
Chapter 2: array and array list data structure
1. DATA STRUCTURE
Chapter 2: Array & Array List
Prepared & Presented by
Mr. Mahmoud R. Alfarra
2011-2012
College of Science & Technology
Dep. Of Computer Science & IT
BCs of Information Technology
http://mfarra.cst.ps
2. Out Line
Print the elements of Arrays
Storing data in Arrays
Swap two elements in array.
How to delete an element from array?
How to insert a new element in array
The concept of complexity
What is Array List? How to use?
2
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
5. Print the elements of 1-D Arrays
5
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. string[] names = { "Ali", "Mahmoud", "Hussam",
"Ala" };
4. for (int i = 0; i < names.Length; i++)
5. Console.WriteLine("The next name is
"+names[i]);
6. Console.Read();
7. }
6. Print the elements of 2-D Arrays
6
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. string[,] names = { {"Ali", "Mahmoud"}, {"Hussam", "Ala"} };
4. for (int i = 0; i < names.GetLength(0); i++)
5. Console.WriteLine("The next name is " + names[i,0]+" “ + names[i,1]);
6. Console.Read();
7. }
7. Storing data in 1-D Arrays
7
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. int[] id = new int[5];
4. for (int i = 0; i < 5; i++)
5. id[i] =int.Parse(Console.ReadLine());
6. Console.WriteLine("==== The numbers in Array are =====");
7. for (int i = 0; i < 5; i++)
8. Console.WriteLine(" Next Number is " + id[i]);
9. Console.ReadLine();
10. }
8. Storing data in 2-D Arrays
8
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. string[,] names = new string[2, 3];
4. for (int i = 0; i < 2; i++)
5. for (int j = 0; j < 3; j++)
6. names[i, j] = Console.ReadLine();
7. for (int i = 0; i < 2; i++)
8. {
9. for (int j = 0; j < 3; j++)
10. Console.Write(names[i, j]);
11. Console.WriteLine();
12. }
13. Console.Read();
14. }
9. Swap two elements in 1-D array
9
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. int[] numbers = { 3, 5, 7, 23, 56, 12 };
4. int x;
5. x = numbers[0];
6. numbers[0] = numbers[1];
7. numbers[1] = x;
8. Console.WriteLine(" ");
9. Console.WriteLine(" The elements of array after swap");
10. for (int i = 0; i < numbers.Length; i++)
11. Console.WriteLine(" "+numbers[i]);
12. Console.Read();
13. }
Try to implement the above example with 2-D array
11. How to delete an element from
array?
11
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. int[] id = { 10, 12, 11, 45 };
4. // to delete the value 12
5. int i;
6. for ( i = 0; i < id.Length-1; i++)
7. {
8. if (id[i] == 12)
9. {
10. break;
11. } }
12. for (int j =i ; j < id.Length-1; j++)
13. id[j] = id[j + 1];
14. for (int k = 0; k < id.Length; k++)
15. Console.WriteLine(" "+id[k]);
16. Console.Read(); }
12. How to delete an element from
array?
12
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. int[] id = { 10, 12, 11, 45 };
4. // to delete the value of index 2
5. for (int i =2 ; i < id.Length-1; i++)
6. id[i] = id[i + 1];
7. for (int k = 0; k < id.Length; k++)
8. Console.WriteLine(" "+id[k]);
9. Console.Read();
10. }
22. How to use Array List?
22
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. ArrayList names = new ArrayList();
4. int po1 = names.Add("Ali");
5. int po2 = names.Add("hussam");
6. int po3 = names.Add("hassan");
7. int po4 = names.Add("Alaa");
8. int po5 = names.Add("wael");
9. Console.WriteLine();
10. Console.WriteLine(" Position of PO1: " + po1 +
11. " Position of PO2: " + po2 + " Position of PO5: " + po5);
12. Console.WriteLine(" number of names in the ArrayList: " +
names.Count);
13. Console.ReadLine();
14. }
Instance variable in
Array List to return
the number of items
in.
23. How to use Array List?
23
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. ArrayList list1 = new ArrayList();
4. list1.Add(40);
5. list1.Add(50);
6. list1.Add(60);
7. list1.Add(70);
8. ArrayList list2 = new ArrayList();
9. list2.Add(80);
10. list2.Add(90);
11. list1.AddRange(list2);
12. Console.WriteLine(" === The elements of list1 are ===");
13. foreach (object x in list1)
14. Console.WriteLine(" "+x);
15. Console.ReadLine();
16. }
24. How to use Array List?
24
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. ArrayList list1 = new ArrayList();
4. list1.Add(40);
5. list1.Add(50);
6. list1.Add(60);
7. list1.Add(70);
8. ArrayList list2 = new ArrayList();
9. list2 = list1.GetRange(0, 3);
10. Console.WriteLine();
11. foreach (object x in list2)
12. Console.WriteLine(" "+x);
13. Console.ReadLine();
14. }
25. How to use Array List?
25
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
1. static void Main(string[] args)
2. {
3. ArrayList list1 = new ArrayList();
4. list1.Add(40);
5. list1.Add(30);
6. list1.Add(10);
7. list1.Add(100);
8. list1.Sort();
9. Console.WriteLine();
10. foreach (object x in list1)
11. Console.WriteLine(" " + x);
12. Console.ReadLine();
13. }
26. Thank you …
26
البيانات تراكيب مساق
إعداد العلمية المادة
/
أ
.
ا َّالفــر رفيق محمود
Remember that: question is the key of knowledge