Algorithms 1- Qs & As
Linked List CORRECT ANS-A linear data structure, much like an array, that consists of
nodes, where each node contains data as well as a link to the next node, but that does not
use contiguous memory.
Head and tail node
The LinkedList class implements the list data structure and contains two data members, head
and tail, which are assigned to nodes once the list is populated. Initially the list has no nodes,
so both data members are initially assigned with None.
If the node has no next node, the next data member is assigned with None, the Python term
signifying the absence of a value.
Deque CORRECT ANS-Short for double-ended queue- an ADT in which items can be
inserted and removed at both the front and back.
Underlying data structures: Linked list
Bag CORRECT ANS-An ADT for storing items in which the order does not matter and
duplicate items are allowed.
Underlying data structures: Linked list, Array
Set CORRECT ANS-An ADT for a collection of distinct items. (no dups!)
Underlying data structures: Binary search tree, Hash table
Priority queue CORRECT ANS-A queue where each item has a priority, and items with
higher priority are closer to the front of the queue than items with lower priority. Dups ok
, WGU C949 Data Types STUDY GUIDE| Data Structures &
Algorithms 1- Qs & As
Underlying data structures: Heap
*In addition to push and pop, a priority queue usually supports peeking and length querying.
A peek operation returns the highest priority item, without removing the item from the front
of the queue.
Pop returns front or head item which is top priority item
Dictionary (Map) CORRECT ANS-A dictionary is an ADT that associates (or maps) keys with
values.
Underlying data structures: Binary search tree, Hash table
Dictionary key characteristic CORRECT ANS-They are unique and immutable.
Dictionary method CORRECT ANS-D1[key].remove(value)
dict.items() CORRECT ANS-returns a view object that yields (key, value) tuples.
dict.keys() CORRECT ANS-returns a view object that yields dictionary keys.
dict.values() CORRECT ANS-returns a view object that yields dictionary values.
Dict for loop CORRECT ANS-A for loop over a dict retrieves each key in the dict.
ie.. for key in dictionary:
dict operations CORRECT ANS-my_dict[key]