Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
2- link-list.ppt
1. Link List
• Arrangement of data in memory
• There are different ways to arrange data in
memory ,
• Array store data sequentially and in cotigious
memory locations that is not either possible nor
efficient in large computer system as
– There should not be enough memory , but there may be
enough blocks
– Array is static data structure
– Access is slow
• To overcome these problems we use link list
2. What is link list
– linked list is a data structure that consists of
a sequence of data records such that in each
record there is a field that contains a
reference (i.e., a link) to the next record in the
sequence.
– In link list data is arrange in records
• Each record is called node
• Data item may be store anywhere in memory
• Each node consist of data and pointer to next item
• Mean the items are connected logically
3. Advantages of link list
• Dynamically allocated data structures can
be linked together to form a chain.
• A linked list is a series of connected
nodes (or links) where each node is a
data structure.
• A linked list can grow or shrink in size as
the program runs.
• because the nodes in a linked list are dynamically
allocated.
4. Single link list
– Singular link list
• Linear collection of data items
• Visiting the elements be from start side to end side
• Y this is called one way link list
• Each node consist of two nodes ,first contain data
and the second contain the pointer to next
• The last node consist pointer NULL while start
variable contain address of first element ,it is also
called list pointer variable
6. Link list operations
• The important operations are
• Traversing
– It is visited form start to end when NULL occur ,so visiting
each element is called traversing
• Insertion
– How to insert a new item in list , at beginning ,at the End
, and it Middle
• Deletion
– How to Delete an item in list , at beginning ,at the End ,
and it Middle
• Searching
– To search for an item in the list.
• Sorting
– So sort the elements in an order…
7. Representation in Memory
• The items of link list are stored in memory in
scattered form but these are linked through
pointers
• Each item is called an object ,while each object
contain at least two fields ,one for to store the data
while other one is for next node address
8. Circular link list
• A link list in which the last node of the list
points back to the first node of the list is
called circular link list
9. Double Link list
• A list in which each node has the address
both of next and previous node is called
Double Link list
• It can be visited in both directions
• In singular list we can’t go back from current node
to previous node .while we can in double l.list
• Its also called two way list
• Each node consist of three field
• One store the data
• 2nd store the address of previous node
• 3rd store the address of next node
10.
11. Double Link list operations
• The important operations are
• Traversing
– It is visited form start to end when NULL occur ,so visiting each
element is called traversing ,we do in both directions
• Insertion
– How to insert a new item in list , at beginning ,at the End , and it
Middle
• Deletion
– How to Delete an item in list , at beginning ,at the End , and it
Middle
• Searching
– To search for an item in the list as array
• Sorting
– So sort the elements in an order…
12. • Operation Name Description
• createList() Create a new list (presumably empty)
• copy() Set one list to be a copy of another
• clear(); Clear a list (remove all elements)
• insert(X, ?) Insert element X at a particular position in the list
• remove(?) Remove element at some position in the list
• get(?) Get element at a given position
• update(X, ?) Replace the element at a given position with X
• find(X) Determine if the element X is in the list
• length() Returns the length of the list.
13. • Functions Description
• start() Moves the “current” pointer to the very first element
• tail() Moves the “current” pointer to the very last element
• next() Move the current position forward one element
• back() Move the current position backward one element