QUESTIONS WITH ANSWERS GRADED A+
◍ Peek.
Answer: ADT operation for a queue that returns but does not remove item at
the front of the queue
◍ Linking together complex nodes into a single structure.
Answer: Linked List
◍ memory allocation.
Answer: the process of an app req and being granted memory
◍ Removes the first node on the list whose value is equal to the argument.
Answer: Remove
◍ A container where data is stored in nodes consisting of a single data item
and a reference to the next node.
Answer: Linked List
◍ Every part of a tree spawns how many children?.
Answer: 0 or more
◍ Bubble Sort Algorithm.
Answer: def shortSort(alist): exchanges = True passnum = len(alist)-1 while
passnum > 0 and exchanges: exchanges = False for i in range(passnum): if
alist[i]>alist[i+1]: exchanges = True temp = alist[i] alist[i] = alist[i+1]
alist[i+1] = temp passnum = passnum-1
◍ This represents an item in a graph..
Answer: vertex
◍ __init__.
Answer: instantiation of a class automatically calls this method defined in
, the class defthis is also known as the constructor
◍ A Last-in, First-out (LIFO) data container.
Answer: Stack
◍ A data structure that stores an ordered list of items, with each item is
directly accessible by a positional index..
Answer: Array
◍ range(5, -6, -1).
Answer: code for every int form 5 down to -5
◍ deque.
Answer: A ______ is a "doubled-ended queue"
◍ min-heap.
Answer: a tree that maintains the simple property that a node's key is less
than or equal to the node's childrens' keys
◍ bucket sort.
Answer: Best: O(n+k)Avg: O(n+k)Worst: O(n^2)Space: O(nk)for uniformly
distributed nums across a range to be sorted
◍ comparison.
Answer: type of operation for comparing data <, > ...
◍ How can a node with Two Children be removed from a tree?.
Answer: Move the successor's child up to the root node.
◍ linked allocation.
Answer: A data structured contains the name, size, and starting block/cluster
address of a file. A table is used to identify the address of each piece of the
file.Storage is allocated using pointers to new locations as needed.
◍ Returns true if the specified value exists in the list, false otherwise.
Answer: Contains
◍ Finds the first node whose value equals the provided argument.
Answer: Find
, ◍ dynamic typing.
Answer: used to determine the type of objects as a program executes;
Python
◍ shell sort.
Answer: Starts by sorting pairs of elements far apart from each other, then
progressively reducing the gap between elements to be compared. Starting
with far apart elements can move some out-of-place elements into position
faster than a simple nearest neighbor exchange.
◍ sorted.
Answer: a list passed to binary_search needs to be...
◍ Nodes that have no children are called what?.
Answer: Leaf nodes
◍ what is an advantage of a linked list over an array?.
Answer: when inserting a new item at the beginning it causes no shift to the
data
◍ A data structure for representing connections among items, and consists of
vertices connected by edges..
Answer: graph
◍ Give a coded example on how to create a doubly linked list.
Answer: Node node1 = new Node(1);Node node2 = new Node(2);Node
node3 = new Node(3);node1.Next = node2;node2.Previous =
node1;node2.Next = node3;node3.Previous = node2;
◍ When something is added to a queue, does it get added to the head or the
tail?.
Answer: Tail
◍ When something is retrieved from a stack, does it come from the top or
bottom of the stack?.
Answer: Top
◍ binary tree.