English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi, currently I'm in a Data Structures and Algorithm class, and I have a question about linked lists. I've read the chapter once and I am about to read it again but I have a few questions.

1) I believe I am failing to see why my description of a linked list is "wrong", an array with each "cell" having 2 parts, 1)First part contains data 2) The Address of the NEXT "cell" except for the last one that contains the address of 0 (NULL)

2)I am having some problems coming up with algorithms for assignments dealing with this, are there any tips, tricks, or advice I could use to get this down faster?

3)I am starting to seriously wonder myself, (from a business stand point) how advanced is the stuff I am doing now, compared to projects out in the field? Is this still "newbie" stuff, or is this more advanced work?

2006-11-28 09:00:45 · 3 answers · asked by D 4 in Computers & Internet Programming & Design

Sorry, spell check actually cut off much of what I said in #1-3 here is the corrected version, NO SPELL CHECK.

1) I believe I am failing to see why my description of a linked list is "wrong", an array with each "cell" having 2 parts,
A)First part contains data, except for the head that contains the address of the next value ONLY
B) The Address of the NEXT "cell" except for the last one that contains the address of 0 (NULL)
C)The Linked List does not have static size, memory can be allocated and deallocated.

Sorry this came out forrmatted badly

2006-11-28 09:07:37 · update #1

3 answers

1. Your description is not entirely wrong, except that a link list is not an array (ie not the array as you read in data structures). The arrays can contain a fixed-max number of elements, whereas a linked list can grow dynamically. Also, as you might know already, inserting an element anywhere in a link list is very easy as compared to inserting an element in an array (except when the element is inserted at the end).

2. I am not sure how helpful will this be - but you can try it out - Use linked list to store a sorted list of employees. Create methods to add and delete employees - each time an employee is added, you have to ensure that the sorted order is preserved (you can choose any field of employee structure to sort the records on - emp no, name, lastname)

3. Rest assured that data-structure is not even close to being obsolete. With all the advanced languages/products that inundate the markets today - data structure still have their own importance. Agreed, not every type of programming will use data structure, but there are a lot of scenarios, that can be best coded using data structures. Though you can still survive if you don't know this topic well (as there are always more than one way to solve a problem), but then your solution may not be as optimized as it would be with use of data structures.

2006-11-28 09:06:06 · answer #1 · answered by SmartSpider 4 · 2 0

1) You're correct, except it is not necessarily an array. The cells are called "nodes", and they do not need to be part of an array (and usually aren't). They can be individual data structures on their own. Each node has data and a pointer to the next node. Otherwise, you're completely right.

2) Your library of routines for linked lists will need a routine to add or remove a link to the list, and to detect if this is the last node. Adding to the end or the beginning of the list is a special consideration. Otherwise, I'll leave it to you to search Google or Yahoo for the terms: linked list example.

3) It is both basic computer science and it is also used at the highest levels. Linked lists are extremely important in many ways. I have been a software engineer for 20 years and I still use them all the time. Some languages have a class called "collection" which handles the linked list for you.

2006-11-28 09:11:51 · answer #2 · answered by Mr. Nozalott 2 · 2 0

links substitute community will provide you genuine time statistical comments approximately how your promoting marketing campaign is going. recommendations approximately visitors, guides, hits, credit, etc. is attainable for you at any time! links substitute community is easy to apply. you may strengthen into our member in under 5 min. and additionally you do not would desire to have specific information.

2016-12-17 17:54:16 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers