Saturday, May 2, 2020

Linked List Basics free essay sample

Most obviously, linked lists are a data structure which you may want to use in real programs. Seeing the strengths and weaknesses of linked lists will give you an appreciation of the some of the time, space, and code issues which are useful to thinking about any data structures in general. Somewhat less obviously, linked lists are great way to learn about pointers. In fact, you may never use a linked list in a real program, but you are certain to use lots of pointers. Linked list problems are a nice combination of algorithms and pointer manipulation. Traditionally, linked lists have been the domain where beginning programmers get the practice to really understand pointers. Audience The article assumes a basic understanding of programming and pointers. The article uses C syntax for its examples where necessary, but the explanations avoid C specifics as much as possible — really the discussion is oriented towards the important concepts of pointer manipulation and linked list algorithms. We will write a custom essay sample on Linked List Basics or any similar topic specifically for you Do Not WasteYour Time HIRE WRITER Only 13.90 / page Other Resources †¢ Link List Problems (http://cslibrary. stanford. edu/105/) Lots of linked list problems, with explanations, answers, and drawings. This 4-12-2001 edition represents minor edits on the 1999 edition. Dedication This document is distributed for free for the benefit and education of all. That a person seeking knowledge should have the opportunity to find it. Thanks to Stanford and my boss Eric Roberts for supporing me in this project. Best regards, Nick -nick. [emailprotected] stanford. edu Section 1 — Linked List Basics Why Linked Lists? Linked lists and arrays are similar since they both store collections of data. The terminology is that arrays and linked lists store elements on behalf of client code. The specific type of element is not important since essentially the same structure works to store elements of any type. One way to think about linked lists is to look at how arrays work and think about alternate approaches. Array Review Arrays are probably the most common data structure used to store collections of elements. In most languages, arrays are convenient to declare and the provide the handy syntax to access any element by its index number. The following example shows some typical array code and a drawing of how the array might look in memory.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.