Week 4 Flashcards
Linear Data Structure
A collection of nodes (elements) where each node has a unique predecessor and a unique successor
What is static array?
A static array is a static structure
Advantages
*Faster access to each entry as long as the index is known - O(1) to visit arr[i]
Disadvantages
*Fixed size - cannot be easily extended or reduced to fit the data set
*Can be expensive to maintain
Limitations of using an array (Searching)
*Unsorted data - linear search (Efficiency O(n))
*Sorted data - binary search (Efficiency O(log2n))
Limitations of using an array (Insertion)
*Unsorted data - (Efficiency O(1))
*Sorted data - (Efficiency O(n))
Limitations of using an array (Deletion)
*Unsorted data - (Efficiency O(1))
*Sorted data - (Efficiency O(n))
What is Linked List ?
*A collection of objects, called nodes
*A dynamic data structure
(The number of nodes in the list is not fixed)
(The linked list can grow and shrink on demand)
Components of every node
*information - to be stored (the data)
*reference - to the next node (often called a link)
Advantages
*Easily extended or reduced to fit the data set
*Efficient - O(1) to insert / delete item, once located
Disadvantages
*Does not allow direct access to individual items
*Uses more memory compared to an array
Components of accessing SLL
*head
(Static variable)
(Contains a reference to the first node)
*head.data
(accesses data sorted in the first node)
*head.link
(reference to the second node)
Other types of Linked Lists
*Singly Linked List with a Dummy Node
*Circular Singly Linked List
*Doubly Linked List
*SkipList
SkipList Data Structure
*Probabilistic data structure
*Based on a set of parallel linked lists
*Has improved efficiency, compared to a SLL, for must operations
Orders in SkipList
*Extension of an ordered SLL with additional forward links, added in a randomized way
*Effect - During a search we can skip parts of the list
*Efficiency - On average all operations are performed in logarithmic randomized time O(log2n)