COP4538

26 flashcardsby Allixar
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
Quicksort Best and Average Runtime Complexity
O(NlogN)
2
What is Data Structures?
Organizing, Storing, and Performing Operations on Data
3
Stack: Push and Pop
Push / append() : Add the integer to the top
Pop / pop(: Remove from the top
Read the table number from top to bottom
4
s.push(5)
s.push(1)
s.push(4)
s.pop()
s.push(2)
s.pop()
s.push(8)
s.push(7)
s.pop()
s.push(3)
3
8
1
5
5
Python Reversing The String Code:
def reverse_string(s):
reversed_string = ""
stack = [] # Initialize an empty stack
# 1. Push each character onto the stack
for char in s:
stack.append(char)
# 2. Pop from the stack and build reversed string
while len(stack) != 0:
reversed_string += stack.pop()
return reversed_string

string_to_reverse = "hello world"

reversed_string = reverse_string(string_to_reverse)

print(reversed_string)
6
In an AVL tree of height 6, what is the maximum nodes?
127
7
In an AVL tree of height 6, what is the minimum nodes?
33
8
Binary Tree Traversals: Pre-Order
Root -> Left -> Right
9
Binary Tree Traversals: In-Order
Left -> Root -> Right
10
Binary Tree Traversals: Post-Order
Left -> Right -> Root
11
What is a record?

Data Structures that stores subitems, fields, with a name associated with each subitem
12
What is an array list []
Mutable or Changeable Data structure that stores an ordered list of items, where each item is directly accessible by a positional index
13
What is a linked list?
data structure that stores an ordered list of items in nodes, where each node stores data and has a pointer to the next node.
14
what is a hash table?
data structure that stores unordered items by mapping (or hashing) each item to a location in an array.
15
A linked list stores items in an unspecified order.
  • True
  • False
16
A node in binary tree can have zero, one, or two children.
  • True
  • False
17
A list node's data can store a record with multiple subitems.
  • True
  • False
18
Items stored in an array can be accessed using a positional index.
  • True
  • False
19
What is an algorithm?

Describes a sequence of steps to solve a computational problem or perform a calculation
20
What is computational problem?
Specifies an input, a question about the input that can be answered using a computer, and the desired output.
21
Do two student essays share a common phrase consisting of a sequence of more than 100 letters?
Longest Common Substring
22
A remove operation for a list ADT removes the specified item. Given a list with contents: 2, 20, 30, what is the list after the following operation?
Remove(list, item 2)
20, 30
23
Priority Queue
Items are ordered based on items' priority. Duplicate items are allowed.
24
F(N) = (2^N)
O(N)
25
F(N) = N^1/2 + LogN
O(N^1/2)
26
F(N) = (N N N * N)^3
O(N)^12
Study all 26 cards for free