allocated to the item and the item is addressed as item number item size In

Allocated to the item and the item is addressed as

This preview shows page 14 - 16 out of 17 pages.

allocated to the item, and the item is addressed as item number × item size In other situations, arrays give way to other data structures. List: list represents a collection of data values as a sequence. Linked List: Most common way of implementing a List in which items are linked to one another • In a singly linked list, each item points to its successor, as illustrated in Figure 1.13. • In a doubly linked list, a given item can refer either to its predecessor or to its successor, as illustrated in Figure 1.14. • In a circularly linked list, the last element in the list refers to the first element, rather than to null, as illustrated in Figure 1.15. Linked lists are of several types: Linked lists accommodate items of varying sizes and allow easy insertion and deletion of items but a disadvantage of retrieving items with a time of O(n) as it requires potentially traversing all n elements in the worst case. They are used ultimately to create other data structures. Stack: a LIFO structure for adding and removing items which is respectively called push and pop. Queue: A contrasting structure to a stack since it uses the FIFO principle An OS uses stacks when invoking function calls, parameter local variables, and the return address are pushed onto the stack when a function is called; returning from the function call pops those items off the stack. For printing pages in an OS we use the queues structures as well as tasks awaiting to run on CPUs are organized in queues 1.10.2 - Trees Tree: A tree is a data structure that can be used to represent data hierarchically. Data values in a tree structure are linked through parent child relationships. In a general tree, a parent may have an unlimited number of children. Binary Search Tree: A parent may have at most two children, which we term the left child and the right child. additionally requires an ordering between the parent’s two children in which le f t child <= right child. When we search for an item in a binary search tree, the worst-case performance is O(n) since it can be a unbalanced tree Balanced Binary Search Tree: Here, a tree containing n items has at most lg n levels, thus ensuring worst-case performance of O(lg n). This remedies the issue of binary search trees that are unbalanced 1.10.3 - Hash Functions and Maps 1.10 Kernel Data Structures Sunday, September 23, 2018 11:13 PM Chapter 1 - Overview Page 14
Image of page 14
hash function: Also a data structure takes data as its input, performs a numeric operation on this data, and returns a numeric value. This numeric value can then be used as an index into a table (typically an array) to quickly retrieve the data. searching for a data item through a list of size n can require up to O(n) comparisons in the worst case, using a hash function for retrieving data from table can be as good as O(1) in the worst case, depending on implementation details Hash collision: That two inputs can result in the same output value that is, they can link to the same table location.
Image of page 15
Image of page 16

You've reached the end of your free preview.

Want to read all 17 pages?

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes