רשימה מקושרת Linked Lists. דוגמא STRING איך עושים Dim x as String בלי לדעת מראש את הגודל !

Slides:



Advertisements
Similar presentations
Inserting a Node into a Specified Position of a Linked List To create a node for the new item newNode = new Node(item); To insert a node between two nodes.
Advertisements

Lists CS 3358.
COMP171 Fall 2005 Lists.
Linked Lists.
Linked Lists Contents 1.LinkedList implements the Interface List 2.Doubly Linked List implementation of common methods a.boolean add( Object x) -- append.
Data Structure Lecture-3 Prepared by: Shipra Shukla Assistant Professor Kaziranga University.
תרגול 8 Skip Lists Hash Tables. Skip Lists Definition: – A skip list is a probabilistic data structure where elements are kept sorted by key. – It allows.
Ics202 Data Structures. hh tail head (b) LinkedList head tail Element datum next 3 Integer Element datum next 1 Integer Element datum next 4 Integer.
Building a Linked List in Java. Linked List In the Procedural Paradigm a linked list consisted of: –A pointer to the head of the list –Nodes (in dynamic.
מבוא למדעי המחשב לתעשייה וניהול דוגמאות ותרגול נוסף במערך חד ממדי הרצאה 12.
Linked List
Chapter 11: Implementing Inheritance and Association Visual Basic.NET Programming: From Problem Analysis to Program Design.
מחרוזות של תווים. מבוא לתכנות למנע"ס - שבוע מספר 5 - מאיר קומר - סמסטר ב' - תשס"ו מחרוזות - Strings Dim s As String s = “hello” s = s & “kita” או s =
הדרכה בשימוש בקטלוג הספרייה מפגש מס ' 2 תשס " ח. מטרת ההדרכה  איתור חומר מתוך הסילבוס  איתור חומר בנושא מבוקש.
סוגי מידע / משתנים ד " ר אבי רוזנפלד. סוגאורךטווח Boolean1 Bit0,1 Byte1 byte0-255 Char 2 bytes תו Decimal16 bytes0 through +/-79,228,162,514,264,337,593,543,950,335.
Linked Lists A linked list is a series of connected nodes Each node contains at least –A piece of data (any type) –Pointer to the next node in the list.
שימוש במערך דינמי : ArrayList. מאפיינים חשובים בכל LIST יכולת להכניס מידע בלי תלות בטיפוס יכולת למחוק מידע יכולת להוסיף מידע פונקציות נוספות ( מיון, חיפוש.
מערכות הפעלה ( אביב 2009) חגית עטיה ©1 מערכת קבצים log-structured  ה log הוא העותק היחיד של הנתונים  כאשר משנים בלוק (data, header) פשוט כותבים את הבלוק.
מערכים מבוא לתכנות למנע"ס - שבוע מספר 8 - מאיר קומר - סמסטר ב' - תשס"ו והנה בעיה כתוב תוכנית אשר תקלוט 36 מספרים ותדפיס כמה מתוכם גדולים יותר מהממוצע.
Stacks and Queues. Stack ADT סוג של מערך מוגבל מהר מאוד ולוקחים מעט זכרון שימוש ב LIFO – LIFO (Last In, First Out) lists. –אפשר להוסיף רק בסוף הרשימה.
אלגוריתמי חיפוש. Brute Force Module Module1 Function BruteForce(ByRef x() As Integer, ByRef item As Integer) As Integer Dim i As Integer For i = 0 To.
תכנות מונחה עצמים Object Oriented Programming (OOP) אתגר מחזור ב' Templates תבניות.
1 מבוא למדעי המחשב סיבוכיות. 2 סיבוכיות - מוטיבציה סידרת פיבונאצ'י: long fibonacci (int n) { if (n == 1 || n == 2) return 1; else return (fibonacci(n-1)
Iterators CS 367 – Introduction to Data Structures.
Chapter 7 Stacks II CS Data Structures I COSC 2006
A Description of a person
מבוא למדעי המחשב לתעשייה וניהול הרצאה 7. סברוטינות subroutines.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
The List ADT A sequence of zero or more elements A 1, A 2, A 3, … A N-1 N: length of the list A 1 : first element A N-1 : last element A i : position i.
Linked Lists Objects->Connected->by->Pointers. What is a Linked List? List: a collection Linked: any individual item points to another item to connect.
מחסנית ותור Stacks and Queues. מחסנית Stack מחסנית - Stack ADT סוג של מערך מוגבל מהיר מאוד ותופס מעט זיכרון שימוש ב LIFO – LIFO (Last In, First Out)
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
Computer Programming for Engineering Applications ECE 175 Intro to Programming.
LINKED LISTS Midwestern State University CMPS 1053 Dr. Ranette Halverson 1.
מבוא למדעי המחשב לתעשייה וניהול הרצאה 12. ספריות.
1 Microsoft® Visual Basic®.NET Language # 2. 2 Flow-Control Statements If … End If Select Case … End Select For… Next Do … Loop Exit.
מחסנית ותור Stacks and Queues. מחסנית Stack מחסנית - Stack ADT סוג של מערך מוגבל מהיר מאוד ותופס מעט זיכרון שימוש ב LIFO – LIFO (Last In, First Out)
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
מבנה נתונים או טיפוס נתונים מופשט חלק ב – פעולות על רשימה הוכן ע " י ולרי פקר דצמבר 2015.
Linked list: a list of items (nodes), in which the order of the nodes is determined by the address, called the link, stored in each node C++ Programming:
Data Structure & Algorithms
1 CS 132 Spring 2008 Chapter 5 Linked Lists p
Linked Lists and Generics Written by J.J. Shepherd.
Linked Lists Single Linked Lists Double Linked Lists.
UNIT-V ABSTRACT DATA TYPE 1.LIST 2.STACK 3.QUEUE EC6301-II-ECE-C.
אלגוריתמי חיפוש. Brute Force Module Module1 Function BruteForce(ByRef x() As Integer, ByRef item As Integer) As Integer Dim i As Integer For i = 0 To.
COMP 53 – Week Eight Linked Lists.
מבוא למדעי המחשב לתעשייה וניהול
UNIT – I Linked Lists.
Linked Lists.
Linked Lists Damian Gordon.
Object Oriented Programming
מחלקות classes.
מבוא למדעי המחשב סיבוכיות.
Linked Lists with Tail Pointers
תירגול 14: מבני נתונים דינאמיים
Chapter 16-2 Linked Structures
1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module
IS437: Fall 2004 Instructor: Dr. Boris Jukic
מחסנית ותור Stacks and Queues.
מבוא לתכנות ב- Java תרגול 10 - רשימות מקושרות.
CS148 Introduction to Programming II
Linked List Functions.
Linked Lists.
Queues: Implemented using Linked Lists
Linked Lists.
Linked Lists.
Presentation transcript:

רשימה מקושרת Linked Lists

דוגמא STRING איך עושים Dim x as String בלי לדעת מראש את הגודל !

Linked Lists A linked list is a series of connected nodes Each node contains at least – A piece of data (any type) – Pointer to the next node in the list Head: pointer to the first node The last node points to NULL A  Head BCA datapointer node

על מה בנוי רשימה מקושרת ? קדקוד (NODE או LINK) –המידע ששומרים ( או אוסף המידע ) –קישור לקדקוד הבא ( מידי פעם גם לקדקוד הקודם ) מחלקה לניהול הקדקודים (LINKED LIST) –פונקציית בנאי (CONSTRUCTOR) –שמירת מקום של הקודקוד הראשון –פונקציית עזר (PRINT, ADD, DELETE, וכו ')

דוגמא של LINK Public Class Link Private m_MyData As String Private m_NextLink As Link Public Sub New(ByVal myParent As Link, ByVal theData As String) m_MyData = theData myParent.m_NextLink = Me End Sub Public Sub New(ByVal theData As String) m_MyData = theData End Sub Function MyData() As String Return m_MyData End Function Function NextLink() As Link Return m_NextLink End Function End Class

דוגמא של LINKEDLIST Public Class LinkedList Private m_CurrentLink As Link Private m_FirstLink As Link Private Size As Integer Public Sub New(ByVal theData As String) m_CurrentLink = New Link(theData) m_FirstLink = m_CurrentLink Size = 1 End Sub Public Function MakeLink(ByVal currentLink As Link, ByVal theData As String) As Link m_CurrentLink = New Link(currentLink, theData) Size = Size + 1 Return m_CurrentLink End Function Function GetNextLink(ByVal aLink As Link) As Link Return aLink.NextLink() End Function Function GetCurrentLink() As Link Return m_CurrentLink End Function Function GetFirstLink() As Link Return m_FirstLink End Function Public Sub PrintAll() Dim i As Integer Dim temp As Link = m_FirstLink For i = 0 To Size - 1 Console.WriteLine("Contents of Place " & i & " is :") Console.WriteLine(temp.MyData) temp = temp.NextLink Next End Sub End Class

שימוש במחלקה (MAIN) Module Module1 Sub Main() Dim List As New LinkedList("Avi") Dim aLink As Link = List.GetCurrentLink aLink = List.MakeLink(aLink, "Bob") aLink = List.MakeLink(aLink, "Chaim") List.PrintAll() End Sub End Module

שיפורים ??? להדפיס טווח של קדקודים להדפיס את הרשימה בסדר יורד חיפוש אחרי מידע (ולהחזיר את התא או התאים שבו הוא נמצא שינוי של הNODE להכניס כמה סוגי מידע איך????????????