Partner Link

Cheap Mobile Phones
- Cheap Mobile Phones - Best Mobile Phone Deals, Laptops, Sat Nav Devices, Cordless Phones, Internet Phones, Broadband Internet Deals from leading retailers of UK. Choose Products and Compare Prices for best deals.

||

Mobile Phones
- Offers mobile phones on contract, pay as you go, sim free deals with free gifts. We compare latest phone deals from leading retailers of UK.

. ||

Custom logo design
Get your company a logo design. Professional logo designs by expert logo designers. Call 0208 133 2514 for custom logo design packages.

||

Top Site

Flyer Printing Flyer Printing – Print your flyers on latest design. We offer cheap flyer printing services in all over UK. Full color flyer printing & art work in your own budget. Order for online flyer printing from your home.
Mobile Broadband Deals  Mobile Broadband - Buy Mobile Broadband Deals, Best Mobile Internet Offers With Free Line Rental, USB Modem and Cheapest Network Connection Offers from 3 Mobile in UK
Mobile Upgrades Upgrade Mobile Phone Deals – upgrade your mobile phones from o2, orange, virgin, vodafone, t-mobile and all Manufacturers Nokia, Samsung, Sony Ericsson, LG ,Blackberry and Motorola. Mobile Broadband Deals Mobile Broadband - Buy Mobile Broadband Deals, Best Mobile Internet Offers With Free Line Rental, USB Modem and Cheapest Network Connection Offers from 3 Mobile in UK.

List data structure

This is a new data structure for you. The List data structure is among the most generic of data structures. In daily life, we use shopping list, groceries list, list of people to invite to a dinner, list of presents to give etc. In this course, we will see how we use lists in programming.

A list is the collection of items of the same type (grocery items, integers, names). The data in arrays are also of same type. When we say int x[6]; it means that only the integers can be stored in it. The same is true for list. The data which we store in list should be of same nature. The items, or elements of the list, are stored in some particular order. What does this mean? Suppose in the list, you have the fruit first which are also in some order. You may have names in some alphabetical order i.e. the names which starts with A should come first followed by the name starting with B and so on. The order will be reserved when you enter data in the list.

It is possible to insert new elements at various positions in the list and remove any element of the list. You have done the same thing while dealing with arrays. You enter the data in the array, delete data from the array. Sometimes the array size grows and at times, it is reduced. We will do this with the lists too.

List is a set of elements in a linear order. Suppose we have four names a1, a2, a3, a4 and their order is as (a3, a1, a2, a4) i.e. a3, is the first element, a1 is the second element, and so on. We want to maintain that order in the list when data is stored in the list. We don’t want to disturb this order. The order is important here; this is not just a random collection of elements but an ordered one. Sometimes, this order is due to sorting i.e. the things that start with A come first. At occasions, the order may be due to the importance of the data items. We will discuss this in detail while dealing with the examples.

Now we will see what kind of operations a programmer performs with a list data structure. Following long list of operations may help you understand the things in a comprehensive manner.
createList() is a function which creates a new list. For example to create an array, we use int x[6] or int* y = new int[20]; we need similar functionality in lists too. The copy() function will create a copy of a list. The function clear() will remove all the elements from a list. We want to insert a new element in the list, we also have to tell where to put it in the list. For this purpose insert(X, position) function is used. Similarly the function remove(position) will remove the element at position. To get an element from the list get(position) function is used which will return the element at position. To replace an element in the list at some position the function update(X, position) is used. The function find(X) will search X in the list. The function length() tells us about the number of elements in the list.

We need to know what is meant by “particular position” we have used “?” for this in the above table. There are two possibilities:

  • Use the actual index of element: i.e. insert it after element 3, get element number 6. This approach is used with arrays
  • Use a “current” marker or pointer to refer to a particular position in the list.
The first option is used in the data structures like arrays. When we have to manipulate the arrays, we use index like x[3], x[6]. In the second option we do not use first, second etc for position but say wherever is the current pointer. Just think of a pointer in the list that we can move forward or backward. When we say get, insert or update while using the current pointer, it means that wherever is the current pointer, get data from that position, insert data after that position or update the data at that position. In this case, we need not to use numbers. But it is our responsibility that current pointer is used in a proper way.

If we use the “current” marker, the following four methods would be useful:

In the next lecture, we will discuss the implementation of the list data structure and write the functions discussed today, in C++ language.

32 comments:

韋于倫成 said...

你要保守你的心,勝過保守一切,因為一生的果效是由心發出........................................

裕以 said...

幫你推個文~~期待更新!加油啊! .............................................

韋于倫成 said...

看後受益良多,謝謝∪ˍ∪........................................

怡潔向霖 said...

今天是人生唯一生存的時間。 ............................................................

心怡心怡 said...

人不能像動物一樣活著,而應該追求知識和美德..................................................

huntb said...

失去金錢的人,失去很多;失去朋友的人,失去更多;失去信心的人,失去所有。..................................................................

明文吳 said...

時間就是靈魂的生命。......................................................................

俊毅俊毅 said...

我來湊熱鬧的~~^^ 要平安快樂哦.....................................................................

俊賢 said...

寂寞又無聊 看到你的BLOG 加油喔!!......................................................................

張瑋劭 said...

知識可以傳授,智慧卻不行。每個人必須成為他自己。......................................................................

皇銘 said...

成熟,就是有能力適應生活中的模糊。....................................................................

慈佐慈佐 said...

喜歡你的部落格,留言請您繼續加油.................................................................

嘉琬嘉琬 said...

成熟,就是有能力適應生活中的模糊。.................................................................

茂慧茂慧 said...

安安!剛開始玩這個,來這裡逛一下^^............................................................

貞合 said...

還是喜歡這裡-支持你..................................................................

香昱信張君林 said...

不簡單..一路走來辛苦了-..................................................................

曹依潔曹依潔 said...

融會貫通的智慧,永遠不會被遺忘。.......................................................

陳明陽陳明陽 said...

教育的目的,不在應該思考什麼,而是教吾人怎樣思考............................................................

士凱士凱 said...

在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

RicoLisi0802志竹 said...

謝謝分享好文章..................................................................

楊容茂楊容茂 said...

來囉~先問聲安.................................[/url]...............

吳許芝蓮佩儒 said...

從來名利地,皆起是非心。.....................................................

亭亭亭蔡和亭亭亭蔡和 said...

Man proposes, God disposes..................................................................

俊陳凱俊陳凱俊陳凱 said...

愛情不是慈善事業,不能隨便施捨。.................................................................

靜錢錢錢怡錢錢錢錢 said...

看著你的BLOG 好多朋友都回應 真厲害..................................................

1615 said...

百發百中不是一試就成的。..................................................

偉冠儒冠儒倫 said...

朋友是一面鏡子......................................................................

万一宇 said...

回應是最大的支持^^y~~~甘吧嗲............................................................

janny said...

This is a list of data structures. For a wider list of terms, see list of terms relating to algorithms and data structures. For a comparison of running time of subset of this list see comparison of data structures.
http://www.delld620.com/

Anonymous said...

Hi, I think your site might be having browser compatibility issues.
When I look at your blog in Firefox, it looks fine but when opening in Internet Explorer,
it has some overlapping. I just wanted to give you a quick
heads up! Other then that, excellent blog!
Have a look at my web-site ; xonlinexslots.wordpress.com

Anonymous said...

This website really has all the information I needed concerning
this subject and didn't know who to ask.

Also visit my web-site - nyam.com.ua

Anonymous said...

Hey there, You've done an incredible job. I will certainly digg it and personally suggest to my friends. I'm confident they'll be benefited from this website.

Here is my blog ... book of ra download free f�book of ra download f�book of ra download pc

Post a Comment

Thanks for interest it