• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/33

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

33 Cards in this Set

  • Front
  • Back

AVL Tree v.s. Sorted Array

Insertion and deletion in Search Array is O(n) and finding is O(log(n)). TVL Tree is worst case scenario O(n).

What is Recursion?

Basic programming technique used in java where a method calls itself to solve some problem.

What is a recursive validity check, base case and recursive case?

Validity check - If program is in fact recursive


Base Case - Case for which the solution can be stated non-recursively.


Recursive Case - The case for which the solution is expressed in terms of a smaller version of itself.

How does bubble sort work?

A stable sort. Considered a sinking sort. Compares adjacent object and the swaps so that the larger object is moved up. O(n^2).

What is Selection Sort and how does it work?

Combination of searching and sorting. While passing through the array the unsorted element is moved into its proper position. Selection sort is unstable. O(n^2).

What is insertion sort and how does it work?

In-Place comparison sorting algorithm. Sub-list is maintained which is always sorted. O(n^2).

What is heap sort and how does it work?

Comparison based sorting algorithm based on Binary Heap. Similar to selection sort. O(n log n).

What is Big O notation?

Used to describe the performance or complexity of an algorithm. Describes worst-case scenario and used to describe execution time required or space used by an algorithm.

Big O measure of asymptotic complexity.

Big O measure of asymptotic complexity.

List.

The order of data items is significant. Duplicate items are permitted. Abstract data type that represents a countable number of ordered values.

Set.

The order of the data items does not matter but duplicate items not permitted.

Bag.

A collection of objects where you can keep adding objects to the bag but you cannot remove objects once added.

Generics.

Generics enable types to be parameters when defining classes, interfaces, and methods.

Benefits of generics.

-Stronger type check at compile time.


-Elimination of casts.


-Enable programmers to implement generic algorithms.

Can a generic be a primitive data type?

No. Generic needs to be abstract data type.

Difference between single and double link list.

-Single link list has a pointer to the next node only.


-Double link list has a pointer to the previous and next node.

What is a queue?

A queue is a FIFO sequence (First In First Out). Insertion takes place only at the tale and removal takes place only at the head.

What is a stack?

A stack is a LIFO sequence (Last In First Out). Addition takes place only at one end called the top.

What are the basic operations of a queue?

-insert(x): add item at tail.


-remove(): remove the item at the head.


-peek: return the item at the head.


-size: return the number of items in the queue.


-isEmpty(): return whether the queue has no items.

What are the basic operations of a stack?

-push(x): add an item to the top.


-pop(): remove the item at the top.


-peek: return the item at the top.


-size: return the number of items in the stack.


-isEmpty: return whether the stack has no items.

Tree:


Node.

A data element in the tree.

Tree:


Parent.

The converse notion of a child.

Tree:


Root.

The top node in a tree.

Tree:


Child.

A node directly connected to another node when moving away from the root.

Tree:


leaf.

A node with no children.

Tree:


Depth.

The depth of a node is the number of edges from the tree's root node to the node.

How to navigate a tree.

Breadth-First: Goes level by level but requires a lot of storage.


Depth-First: Goes out as far as possible and backtracks, only requires as much storage space as the tree's depth.

How to create an array.

Array = new dataType[arraySize];

How to declare array.

dataType[] array;

How to instantiate array.

array[1] = 2.

Difference between array and arraylist.

-Resizable: Array is static in size while arraylist is dynamic in size.


-Primitives: ArrayList cannot contain primitive data types(int, float, double) it can only contain Object. Array can contain both primitive and objects.


-ArrayList is always single dimensional.


-ArrayList slow in comparison to array.

O() of Array v.s. Linked List.

Add:


Linked List - O(1)


Array - N/A


Remove:


Linked List - O(1)


Array - N/A

Difference between Array and Linked List.

-Linked List is dynamic in size and easy to insert and delete.


-Array is static in size.


-Linked List has to access elements sequentially starting from first node.


-Extra memory space for linked list pointer.


--Array has better cache locality that makes better performance.