Download free for 30 days
Sign in
Upload
Language (EN)
Support
Business
Mobile
Social Media
Marketing
Technology
Art & Photos
Career
Design
Education
Presentations & Public Speaking
Government & Nonprofit
Healthcare
Internet
Law
Leadership & Management
Automotive
Engineering
Software
Recruiting & HR
Retail
Sales
Services
Science
Small Business & Entrepreneurship
Food
Environment
Economy & Finance
Data & Analytics
Investor Relations
Sports
Spiritual
News & Politics
Travel
Self Improvement
Real Estate
Entertainment & Humor
Health & Medicine
Devices & Hardware
Lifestyle
Change Language
Language
English
Español
Português
Français
Deutsche
Cancel
Save
Submit search
EN
Uploaded by
Dr. Ahmed J. Obaid
35 views
Linked list proj
نمير حيدر عمران كلية علوم الحاسوب و الرياضيات
Science
◦
Related topics:
Linked List Overview
•
Read more
0
Save
Share
Embed
Embed presentation
Download
Download to read offline
1
/ 4
2
/ 4
3
/ 4
4
/ 4
More Related Content
DOCX
Import java
by
wildled
DOCX
Algoritmos 4
by
Santiago Edd
PPT
Шаблоны проектирования 2
by
Constantin Kichinsky
PPTX
Java весна 2013 лекция 6
by
Technopark
PPTX
Java лаб13
by
Enkhee99
PDF
Project
by
taufiq26
DOC
Java
by
Dany Ianko
PDF
成果整理表
by
neymasem
Import java
by
wildled
Algoritmos 4
by
Santiago Edd
Шаблоны проектирования 2
by
Constantin Kichinsky
Java весна 2013 лекция 6
by
Technopark
Java лаб13
by
Enkhee99
Project
by
taufiq26
Java
by
Dany Ianko
成果整理表
by
neymasem
What's hot
PPTX
โปรแกรมย่อยและฟังก์ชั่นมาตรฐาน
by
Tipprapa Sungsinchai
PDF
Bài tập tuần 2
by
Cong Nguyen
PDF
Bai tap tham khao CSPE
by
mrcoffee282
PDF
Comprendre la programmation fonctionnelle, Blend Web Mix le 02/11/2016
by
Loïc Knuchel
PDF
Prof.js
by
uupaa
DOCX
Void numero
by
Oiga Lin
PPTX
Java весна 2013 лекция 7
by
Technopark
PDF
An introduction to functional programming with Go [redux]
by
Eleanor McHugh
DOCX
matrix operation using operator overloading
by
maria azam
PDF
1- Sourcecode Array
by
Fajar Baskoro
PPT
Tugas pw [10]
by
guestf689463
PPT
Tugas pw [10]
by
guest272e50
RTF
Ejercicio8
by
jbersosa
DOCX
Simulacion - Algoritmo congruencial cuadratico
by
José Antonio Sandoval Acosta
DOCX
Tugas pak putu
by
Roham Firham
PDF
Effective java 摘選條目分享 2 - 泛型
by
Kane Shih
โปรแกรมย่อยและฟังก์ชั่นมาตรฐาน
by
Tipprapa Sungsinchai
Bài tập tuần 2
by
Cong Nguyen
Bai tap tham khao CSPE
by
mrcoffee282
Comprendre la programmation fonctionnelle, Blend Web Mix le 02/11/2016
by
Loïc Knuchel
Prof.js
by
uupaa
Void numero
by
Oiga Lin
Java весна 2013 лекция 7
by
Technopark
An introduction to functional programming with Go [redux]
by
Eleanor McHugh
matrix operation using operator overloading
by
maria azam
1- Sourcecode Array
by
Fajar Baskoro
Tugas pw [10]
by
guestf689463
Tugas pw [10]
by
guest272e50
Ejercicio8
by
jbersosa
Simulacion - Algoritmo congruencial cuadratico
by
José Antonio Sandoval Acosta
Tugas pak putu
by
Roham Firham
Effective java 摘選條目分享 2 - 泛型
by
Kane Shih
More from Dr. Ahmed J. Obaid
PDF
Os lecture 7
by
Dr. Ahmed J. Obaid
PDF
Os lecture 6
by
Dr. Ahmed J. Obaid
PDF
Os lecture 5
by
Dr. Ahmed J. Obaid
PDF
Operating System Lecture 4
by
Dr. Ahmed J. Obaid
PDF
Operating System Lecture 3
by
Dr. Ahmed J. Obaid
PDF
Operating System Lecture 2
by
Dr. Ahmed J. Obaid
PDF
Operating System Lecture 1
by
Dr. Ahmed J. Obaid
Os lecture 7
by
Dr. Ahmed J. Obaid
Os lecture 6
by
Dr. Ahmed J. Obaid
Os lecture 5
by
Dr. Ahmed J. Obaid
Operating System Lecture 4
by
Dr. Ahmed J. Obaid
Operating System Lecture 3
by
Dr. Ahmed J. Obaid
Operating System Lecture 2
by
Dr. Ahmed J. Obaid
Operating System Lecture 1
by
Dr. Ahmed J. Obaid
Linked list proj
1.
/* نمير حيدر عمران اﻷثنين
27 أبريل */ import java.util.NoSuchElementException; public class test1 { public static void main(String[] args) { //مثال عﻠﻰ متغير من نوع linkedList يبين عمﻠية اﻷنشاء و //اﻷضافة و الحذف و عمﻠية عرض العناصر و طباعتها linkedList<String> linkedList = new linkedList<>(); //اﻷضافة linkedList.add("1"); linkedList.add(null); linkedList.add("3"); linkedList.add("4"); linkedList.add(0,"deleted element"); //الحذف linkedList.delete(4); //أستدعاء العناصر و طباعتها for (int i = 0; i < linkedList.size; i++) { System.out.println(linkedList.get(i)); } } /** * class node * هذا الكﻼس يمثل ال(node) المستخدمة فﻲ خوارزمية ال(inkedList) * وتحتوي عﻠﻰ متغيرين ﻛما يﻠﻲ * data --> (node)تحمل بيانات ال * next --> القادم (node)تﺆﺷر عﻠﻰ ال * @param <E> نوع البيانات المستخدم خﻼل أستدعاء ال(class) مثل int او String <-- */ public static class node<E> { E data; node<E> next; //constructor --> يستخدم لتغيير و تحديد قيم المتغيرات داخﻠه public node(E data, node<E> next) { this.data = data; this.next = next; } } /** * class linkedList * الخوارزمية الكامﻠة ﻻنشاء ال(linkedList) و ادارتها و تنفيذ العمﻠيات الشائعة عﻠيها * و ما يﻠﻲ مﺠموعة من العمﻠيات المطبقة عﻠﻰ ال(linkedList) فﻲ هذه الخوارزمية * * get(int index) --> (index)المختار حسﺐ ال (node)ترﺟﻊ قيمة البيانات الموﺟودة داخل ال * getFirst() --> (linkedList)فﻲ ال (node) ترﺟﻊ بيانات أول * gentlest() --> (linkedList)فﻲ ال (node) ترﺟﻊ بيانات أخر * --------------------------------------------------------------------- * add(E val) --> ﺟديد (node) أضافة * add(int index, E val) --> ﺟديد فﻲ أي مكان محدد (node) أضافة * addLast(E val) --> ﺟديد فﻲ النهاية (node) أضافة * addFirst(E val) --> ﺟديد فﻲ البداية (node) أضافة * --------------------------------------------------------------------- * deleteFirst() --> مسﺢ اول عنﺼر * deleteLast() --> مسﺢ أخر عنﺼر * delete(int index) --> مسﺢ من أي مكان * ---------------------------------------------------------------------
2.
* indexChecker(int index)
--> لمعرفة أذا ﻛان صالﺢ لﻸستخدام أم ﻻ(مستخدمة فﻲ أﻛثر من موضﻊ فﻲ الخوارزمية مثل اﻷضافة و الحذف) (index)تختبر ال * node(int index) --> (index)حسﺐ قيمة ال (node) تعيد أي * * المتغيرات الرئيسية فﻲ الخوارزمية * first --> (linkedList)محدد يستخدم لتحديد أول عنﺼر فﻲ ال * last --> (linkedList)محدد يستخدم لتحديد أخر عنﺼر فﻲ ال * size --> (linkedList)عدد عناصر ال * @param <E> نوع البيانات المستخدم خﻼل أستدعاء ال(class) مثل int او String <-- */ public static class linkedList<E> { transient node<E> first; transient node<E> last; int size; public E get(int index) { node<E> n = node(index); return n.data; } public E getFirst() { node<E> f = first; if (f == null) { throw new NoSuchElementException(); } return f.data; } public E getLast() { node<E> l = last; if (l == null) { throw new NoSuchElementException(); } return l.data; } public void add(E val) { addLast(val); } public void add(int index, E val) { if (index == size) { addLast(val); } else if (index == 0) { addFirst(val); } else { indexChecker(index); if (first == null && last == null) { first = new node<>(val, null); } else if (first != null && last == null) { last = new node<>(val, null); first.next = last; } else if (first != null && last != null) { node<E> node = node(index); node<E> prevNode = node(index - 1); node<E> newNode = new node<>(val, node); prevNode.next = newNode; } size++; } }
3.
public void addLast(E
val) { if (first == null && last == null) { first = new node<>(val,null); } else if (first != null && last == null) { last = new node<>(val, null); first.next = last; } else if (first != null && last != null) { node<E> temp = last; last = new node<>(val, null); temp.next = last; } size++; } public void addFirst(E val) { if (first == null && last == null) { first = new node<>(val,null); } else if (first != null && last == null) { last = first; first = new node<>(val, last); } else if (first != null && last != null) { node<E> temp = first; first = new node<>(val, temp); } size++; } public void deleteFirst() { node<E> temp = first; first = first.next; temp = null; size--; } public void deleteLast() { node<E> prev = node(size - 2); prev.next = null; size--; } public void delete(int index) { if (index == 0) { deleteFirst(); } else if (index == size - 1) { deleteLast(); } else { node<E> node = node(index); node<E> prevNode = node(index - 1); prevNode.next = node.next; size--; } } private void indexChecker(int index) { if (!(index >= 0 && index < size)) { throw new IndexOutOfBoundsException("at index of: " + index); } } private node<E> node(int index) { indexChecker(index);
4.
node<E> x; x =
first; for (int i = 0; i < index; i++) { x = x.next; } return x; } } }
Download